0
0
Terraformcloud~10 mins

Why patterns solve common problems 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 define a resource block in Terraform.

Terraform
resource "aws_instance" "example" {
  ami           = "ami-12345678"
  instance_type = "[1]"
}
Drag options to blanks, or click blank then click option'
At3.micro
Bm4.large
Ct2.micro
Dc5.xlarge
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing an instance type that does not exist or is too large for simple examples.
2fill in blank
medium

Complete the code to specify the provider in Terraform configuration.

Terraform
provider "aws" {
  region = "[1]"
}
Drag options to blanks, or click blank then click option'
Aap-southeast-2
Bus-west-1
Ceu-central-1
Dus-east-1
Attempts:
3 left
💡 Hint
Common Mistakes
Selecting a region that is less common or not supported in the example.
3fill in blank
hard

Fix the error in the Terraform variable declaration.

Terraform
variable "instance_count" {
  type    = [1]
  default = 1
}
Drag options to blanks, or click blank then click option'
A"string"
B"number"
Cnumber
Dint
Attempts:
3 left
💡 Hint
Common Mistakes
Using quoted types like "number" or language-specific types like int instead of Terraform type keywords.
4fill in blank
hard

Fill both blanks to create a map variable with default values.

Terraform
variable "tags" {
  type    = [1]
  default = [2]
}
Drag options to blanks, or click blank then click option'
Amap(string)
Blist(string)
C{"Environment" = "dev", "Owner" = "team"}
D["dev", "team"]
Attempts:
3 left
💡 Hint
Common Mistakes
Using list type instead of map, or using list syntax for default values.
5fill in blank
hard

Fill all three blanks to output the instance ID from a resource.

Terraform
output "instance_id" {
  value = [1].[2].[3]
}
Drag options to blanks, or click blank then click option'
Aaws_instance
Bexample
Cid
Dinstance
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect resource names or attributes that do not exist.