Course outlines for learning terraform.
expected time | requirements |
---|---|
30 minutes | A computer with Terraform installed, terraform knowledge. |
Goal: Get familiar with Terraform workspaces.
Terraform workspaces can be used create different locations to store state. It also introduces an extra variable: terraform.workspace
.
You’re always working in a workspace, but if you do no select one, you’re in the default
workspace.
The arguments can be either of new
, select
, list
, delete
or show
.
terraform workspace new my_workspace
terraform workspace select default
terraform workspace list
terraform workspace delete my_workspace
See this Azure repo or use the generic repo.
terraform.workspace
variable to change the name
of a resource.location
or size
. (locals.tf)terraform apply
production
and run terraform apply
again.locals.tf
, to fall back to default
if the workspace can’t be found in _amount_of_machines
. Hint: Use the try
function.terraform init
not required?