0
0
Terraformcloud~10 mins

Resource block syntax in Terraform - Interactive Code Practice

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

Complete the code to declare an AWS S3 bucket resource.

Terraform
resource "aws_s3_bucket" [1] {
  bucket = "my-bucket"
  acl    = "private"
}
Drag options to blanks, or click blank then click option'
Amy_bucket_name
Bmy_bucket_resource
Cmy_bucket_id
Dmy_bucket
Attempts:
3 left
💡 Hint
Common Mistakes
Using the bucket name as the resource name directly.
Using invalid characters in the resource name.
2fill in blank
medium

Complete the code to specify the resource type for an AWS EC2 instance.

Terraform
resource [1] "web_server" {
  ami           = "ami-0c55b159cbfafe1f0"
  instance_type = "t2.micro"
}
Drag options to blanks, or click blank then click option'
Aaws_instance
Baws_vm
Cec2_instance
Daws_ec2
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect resource type names like aws_ec2 or aws_vm.
Confusing resource type with resource name.
3fill in blank
hard

Fix the error in the resource block by completing the missing keyword.

Terraform
resource "aws_s3_bucket" "my_bucket" [1] 
  bucket = "my-bucket"
  acl    = "private"
}
Drag options to blanks, or click blank then click option'
Abegin
B{
C(
Dstart
Attempts:
3 left
💡 Hint
Common Mistakes
Using parentheses or other keywords instead of curly braces.
Omitting the opening brace entirely.
4fill in blank
hard

Fill both blanks to complete the resource block for an AWS security group.

Terraform
resource [1] [2] {
  name        = "allow_ssh"
  description = "Allow SSH inbound traffic"
  vpc_id      = var.vpc_id
}
Drag options to blanks, or click blank then click option'
Aaws_security_group
Baws_sg
Callow_ssh
Dsecurity_group
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect resource types like aws_sg.
Using resource type as the resource name.
5fill in blank
hard

Fill both blanks to complete the resource block for an AWS IAM role.

Terraform
resource [1] [2] {
  name = "example_role"
  assume_role_policy = data.aws_iam_policy_document.assume_role_policy.json
}
Drag options to blanks, or click blank then click option'
Aaws_iam_role
Bexample_role
C{
Daws_role
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect resource types like aws_role.
Omitting the opening brace or using wrong symbols.