0
0
Terraformcloud~10 mins

Workspaces vs directory-based separation in Terraform - Interactive Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to select the Terraform workspace named 'dev'.

Terraform
terraform workspace select [1]
Drag options to blanks, or click blank then click option'
Aprod
Btest
Cdev
Dstaging
Attempts:
3 left
💡 Hint
Common Mistakes
Using a workspace name that does not exist
Typing the workspace name incorrectly
2fill in blank
medium

Complete the code to initialize Terraform in the current directory.

Terraform
terraform [1]
Drag options to blanks, or click blank then click option'
Ainit
Bdestroy
Cplan
Dapply
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'apply' before initialization
Confusing 'plan' with 'init'
3fill in blank
hard

Fix the error in the command to create a new workspace named 'test'.

Terraform
terraform workspace [1] test
Drag options to blanks, or click blank then click option'
Aselect
Bdelete
Cnew-workspace
Dnew
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'select' instead of 'new'
Using invalid commands like 'new-workspace'
4fill in blank
hard

Fill both blanks to define a backend configuration for Terraform state stored in an S3 bucket.

Terraform
terraform {
  backend "[1]" {
    bucket = "my-terraform-state"
    region = "[2]"
  }
}
Drag options to blanks, or click blank then click option'
As3
Bgcs
Cus-west-2
Dus-east-1
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'gcs' which is for Google Cloud Storage
Using invalid region names
5fill in blank
hard

Fill all three blanks to create a directory-based separation with environment-specific variables in Terraform.

Terraform
variable "region" {
  type    = string
  default = "[1]"
}

provider "aws" {
  region = var.[2]
}

resource "aws_instance" "example" {
  ami           = "ami-123456"
  instance_type = "t2.micro"
  tags = {
    Environment = "[3]"
  }
}
Drag options to blanks, or click blank then click option'
Aus-west-1
Bregion
Cdev
Dprod
Attempts:
3 left
💡 Hint
Common Mistakes
Using mismatched variable names
Setting environment tag incorrectly