0
0
Terraformcloud~10 mins

Why scaling Terraform matters - 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 Terraform in the current directory.

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

Complete the code to apply Terraform changes automatically without asking for confirmation.

Terraform
terraform apply [1]
Drag options to blanks, or click blank then click option'
A-refresh=false
B-destroy
C-auto-approve
D-lock=false
Attempts:
3 left
💡 Hint
Common Mistakes
Using '-destroy' instead of '-auto-approve' applies destructive changes.
Confusing '-lock=false' with approval flags.
3fill in blank
hard

Fix the error in the backend configuration block to enable remote state storage.

Terraform
terraform {
  backend "s3" {
    bucket = "my-terraform-state"
    key    = [1]
    region = "us-east-1"
  }
}
Drag options to blanks, or click blank then click option'
A"terraform.tfstate"
Bterraform.tfstate
Cterraform_state
D"statefile"
Attempts:
3 left
💡 Hint
Common Mistakes
Omitting quotes causes syntax errors.
Using invalid key names that don't match the expected format.
4fill in blank
hard

Fill both blanks to create a resource block for an AWS EC2 instance with a specific AMI and instance type.

Terraform
resource "aws_instance" "example" {
  ami           = [1]
  instance_type = [2]
}
Drag options to blanks, or click blank then click option'
A"ami-0c55b159cbfafe1f0"
B"t2.micro"
Cami-12345678
Dt2.small
Attempts:
3 left
💡 Hint
Common Mistakes
Leaving out quotes causes errors.
Using invalid AMI or instance type values.
5fill in blank
hard

Fill all three blanks to define an output that shows the public IP of an AWS instance.

Terraform
output "instance_ip" {
  value = [1].[2].[3]
}
Drag options to blanks, or click blank then click option'
Aaws_instance
Bexample
Cpublic_ip
Dprivate_ip
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'private_ip' instead of 'public_ip' for the output.
Mixing resource names or types incorrectly.