0
0
Terraformcloud~10 mins

Why the workflow matters in Terraform - Test Your Understanding

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

Complete the code to initialize the Terraform working directory.

Terraform
terraform [1]
Drag options to blanks, or click blank then click option'
Ainit
Bapply
Cplan
Ddestroy
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'apply' before initializing causes errors.
Confusing 'plan' with initialization.
2fill in blank
medium

Complete the code to see what changes Terraform will make.

Terraform
terraform [1]
Drag options to blanks, or click blank then click option'
Ainit
Bplan
Capply
Dvalidate
Attempts:
3 left
💡 Hint
Common Mistakes
Running 'apply' without checking the plan first.
Using 'init' instead of 'plan' to preview changes.
3fill in blank
hard

Fix the error in the command to apply changes safely.

Terraform
terraform [1] -auto-approve
Drag options to blanks, or click blank then click option'
Aplan
Brefresh
Capply
Ddestroy
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'plan' with '-auto-approve' which does nothing.
Confusing 'destroy' with applying changes.
4fill in blank
hard

Fill both blanks to create a resource and output its ID.

Terraform
resource "aws_instance" "example" {
  ami           = "ami-123456"
  instance_type = "t2.micro"
}

output "instance_id" {
  value = aws_instance.[1].[2]
}
Drag options to blanks, or click blank then click option'
Aexample
Bid
Cname
Dinstance
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'name' instead of 'id' for the output value.
Using a wrong resource name.
5fill in blank
hard

Fill all three blanks to define a variable with a default value and use it in a resource.

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

resource "aws_s3_bucket" "bucket" {
  bucket = var.[3]
  acl    = "private"
}
Drag options to blanks, or click blank then click option'
Abucket_name
Bmy-bucket-123
Dbucket_id
Attempts:
3 left
💡 Hint
Common Mistakes
Mismatching variable names between declaration and usage.
Using an incorrect default value format.