Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to define a resource block in Terraform.
Terraform
resource "aws_instance" "example" [1] ami = "ami-12345678" instance_type = "t2.micro"
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using square brackets instead of curly braces.
Using parentheses instead of curly braces.
✗ Incorrect
The resource block in Terraform starts with a curly brace { to open the block.
2fill in blank
mediumComplete the code to close the resource block correctly.
Terraform
resource "aws_instance" "example" { ami = "ami-12345678" instance_type = "t2.micro" [1]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using square brackets or parentheses to close the block.
Forgetting to close the block.
✗ Incorrect
The resource block must be closed with a curly brace } to end the block.
3fill in blank
hardFix the error in the block syntax by completing the code.
Terraform
variable "region" [1] default = "us-west-2" }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using square brackets or parentheses instead of curly braces.
Missing the opening brace.
✗ Incorrect
The variable block must start with a curly brace { to open the block.
4fill in blank
hardFill both blanks to complete the nested block structure.
Terraform
resource "aws_security_group" "example" [1] ingress [2] from_port = 80 to_port = 80 protocol = "tcp" } }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using different types of brackets for nested blocks.
Mismatching opening and closing braces.
✗ Incorrect
Both the resource and the nested ingress block use curly braces { to open their blocks.
5fill in blank
hardFill all three blanks to complete the provider block with nested configuration.
Terraform
provider "aws" [1] region = "us-east-1" assume_role [2] role_arn = "arn:aws:iam::123456789012:role/example" [3] }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using square brackets or other symbols instead of curly braces.
Forgetting to close the nested block.
✗ Incorrect
The provider block and the nested assume_role block both open with { and close with }.