0
0
Terraformcloud~10 mins

Test file structure 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 define a Terraform provider block.

Terraform
provider "aws" {
  region = "[1]"
}
Drag options to blanks, or click blank then click option'
Aregion_name
Bus-west-2
Caws_region
Ddefault
Attempts:
3 left
💡 Hint
Common Mistakes
Using variable names instead of actual region codes.
Leaving the region attribute empty.
2fill in blank
medium

Complete the code to define a Terraform resource block for an AWS S3 bucket.

Terraform
resource "aws_s3_bucket" "[1]" {
  bucket = "my-unique-bucket-name"
  acl    = "private"
}
Drag options to blanks, or click blank then click option'
Amy_bucket
Bbucket
Cs3_bucket
Dbucket_name
Attempts:
3 left
💡 Hint
Common Mistakes
Using reserved words or invalid characters in the resource name.
Using the same name as the resource type.
3fill in blank
hard

Fix the error in the Terraform variable declaration block.

Terraform
variable "instance_type" {
  type    = [1]
  default = "t2.micro"
}
Drag options to blanks, or click blank then click option'
A"string"
Bstr
Cstring
Dtext
Attempts:
3 left
💡 Hint
Common Mistakes
Putting quotes around the type keyword.
Using invalid type names.
4fill in blank
hard

Fill both blanks to create a Terraform output that shows the public IP of an AWS instance.

Terraform
output "instance_ip" {
  value = [1].[2]
}
Drag options to blanks, or click blank then click option'
Aaws_instance.example
Bpublic_ip
Cprivate_ip
Dinstance_id
Attempts:
3 left
💡 Hint
Common Mistakes
Using private_ip instead of public_ip.
Using incorrect resource names.
5fill in blank
hard

Fill all three blanks to define a Terraform AWS security group with an ingress rule allowing HTTP traffic.

Terraform
resource "aws_security_group" "[1]" {
  name        = "[2]"
  description = "Allow HTTP inbound"

  ingress {
    from_port   = [3]
    to_port     = 80
    protocol    = "tcp"
    cidr_blocks = ["0.0.0.0/0"]
  }
}
Drag options to blanks, or click blank then click option'
Aweb_sg
Bweb-security-group
C80
D443
Attempts:
3 left
💡 Hint
Common Mistakes
Using port 443 instead of 80 for HTTP.
Using invalid resource or group names.