Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to define an AWS S3 bucket resource.
Terraform
resource "aws_s3_bucket" "my_bucket" { bucket = [1] }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Not using quotes around the bucket name.
Using an undefined variable name.
✗ Incorrect
The bucket name must be a string in quotes to be valid in Terraform.
2fill in blank
mediumComplete 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Using an invalid version format.
Using "latest" which is not recommended.
✗ Incorrect
The version constraint "~> 2.0" means compatible with 2.x versions.
3fill in blank
hardFix the error in the resource block by completing the missing argument.
Terraform
resource "aws_instance" "example" { ami = "ami-12345678" instance_type = [1] }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Omitting quotes around the instance type.
Using incorrect instance type names.
✗ Incorrect
The instance_type must be a string with quotes, e.g., "t2.micro".
4fill in blank
hardFill both blanks to create a security group with an ingress rule allowing HTTP traffic.
Terraform
resource "aws_security_group" "web_sg" { name = "web_sg" description = "Allow HTTP inbound" ingress { from_port = [1] to_port = [2] protocol = "tcp" cidr_blocks = ["0.0.0.0/0"] } }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using SSH port 22 instead of HTTP port 80.
Using different ports for from_port and to_port.
✗ Incorrect
HTTP traffic uses port 80, so both from_port and to_port should be 80.
5fill in blank
hardFill 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Using private_ip instead of public_ip.
Mixing resource names or types incorrectly.
✗ Incorrect
The output references the resource aws_instance.example.public_ip to show the instance's public IP address.