Complete the code to declare an AWS S3 bucket resource.
resource "aws_s3_bucket" "my_bucket" { bucket = [1] }
The bucket name must be a string in quotes and unique globally. So we use a quoted string like "my-unique-bucket-name".
Complete the code to specify the AWS provider version.
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = [1]
}
}
}The version must be a string with version constraints, like "~> 4.0" to specify compatible versions.
Fix the error in the resource declaration by completing the blank.
resource "aws_instance" "example" { ami = "ami-12345678" instance_type = [1] }
The instance_type must be a string in quotes, like "t2.micro".
Fill both blanks to create a security group allowing HTTP traffic.
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"] } }
The name and description must be strings. Here, "web_sg" is a good name and "Allow HTTP traffic" describes the rule.
Fill all three blanks to define an output that shows the instance's public IP.
output "instance_ip" { value = [1].[2].[3] }
The output value accesses the public_ip attribute of the aws_instance resource named example.