0
0
Terraformcloud~10 mins

Terraform's declarative approach - 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" "my_bucket" {
  bucket = [1]
}
Drag options to blanks, or click blank then click option'
Amy_bucket
B"my-unique-bucket-name"
Cbucket_name
D"bucket"
Attempts:
3 left
💡 Hint
Common Mistakes
Not using quotes around the bucket name
Using an invalid bucket name without uniqueness
2fill in blank
medium

Complete the code to specify the AWS provider version.

Terraform
terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = [1]
    }
  }
}
Drag options to blanks, or click blank then click option'
A>= 2.0.0
B"latest"
C4.0
D"~> 4.0"
Attempts:
3 left
💡 Hint
Common Mistakes
Not using quotes around the version
Using an invalid version format
3fill in blank
hard

Fix the error in the resource declaration by completing the blank.

Terraform
resource "aws_instance" "example" {
  ami           = "ami-12345678"
  instance_type = [1]
}
Drag options to blanks, or click blank then click option'
A"t2.micro"
Bt2micro
Ct2.micro
Dmicro
Attempts:
3 left
💡 Hint
Common Mistakes
Omitting quotes around the instance type
Using incorrect instance type names
4fill in blank
hard

Fill both blanks to create a security group allowing HTTP traffic.

Terraform
resource "aws_security_group" "web_sg" {
  name        = [1]
  description = [2]

  ingress {
    from_port   = 80
    to_port     = 80
    protocol    = "tcp"
    cidr_blocks = ["0.0.0.0/0"]
  }
}
Drag options to blanks, or click blank then click option'
A"web_sg"
B"Allow HTTP traffic"
C"http_sg"
D"Open port 80"
Attempts:
3 left
💡 Hint
Common Mistakes
Not using quotes around strings
Using unclear or missing descriptions
5fill in blank
hard

Fill all three blanks to define an output that shows the instance's public IP.

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
Incorrect resource or attribute names