0
0
Terraformcloud~10 mins

Why IaC over manual provisioning 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 in Terraform.

Terraform
resource "aws_instance" "example" {
  ami           = "ami-12345678"
  instance_type = "[1]"
}
Drag options to blanks, or click blank then click option'
At2.nano
Bt2.small
Ct2.medium
Dt2.micro
Attempts:
3 left
💡 Hint
Common Mistakes
Using an invalid instance type string.
Leaving the instance_type blank.
2fill in blank
medium

Complete the code to initialize Terraform in your project 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 terraform apply before initialization.
Confusing init with plan or apply.
3fill in blank
hard

Fix the error in the Terraform code to output the instance's public IP.

Terraform
output "instance_ip" {
  value = aws_instance.example.[1]
}
Drag options to blanks, or click blank then click option'
Apublic_ip
Bprivate_ip
Cip_address
Dinstance_ip
Attempts:
3 left
💡 Hint
Common Mistakes
Using private_ip instead of public_ip.
Using a non-existent attribute like ip_address.
4fill in blank
hard

Fill both blanks to create a variable with a default value in Terraform.

Terraform
variable "region" {
  type    = [1]
  default = [2]
}
Drag options to blanks, or click blank then click option'
Astring
B"us-west-2"
C"number"
D"eu-central-1"
Attempts:
3 left
💡 Hint
Common Mistakes
Using number type for a region variable.
Setting default to an unsupported region string.
5fill in blank
hard

Fill all three blanks to create a resource with tags in Terraform.

Terraform
resource "aws_s3_bucket" "bucket" {
  bucket = [1]
  acl    = [2]
  tags = {
    Name        = [3]
  }
}
Drag options to blanks, or click blank then click option'
A"my-unique-bucket-123"
B"private"
C"MyBucket"
D"public-read"
Attempts:
3 left
💡 Hint
Common Mistakes
Using a non-unique bucket name.
Setting acl to "public-read" without intention.
Omitting tags or using incorrect syntax.