Complete the code to define a resource in Terraform.
resource "aws_instance" "example" { ami = "ami-12345678" instance_type = "[1]" }
The instance_type specifies the size of the instance. "t2.micro" is a valid and common choice.
Complete the code to initialize Terraform in your project directory.
terraform [1]terraform init initializes the working directory containing Terraform configuration files.
Fix the error in the Terraform code to output the instance's public IP.
output "instance_ip" { value = aws_instance.example.[1] }
The correct attribute to get the public IP of an AWS instance is public_ip.
Fill both blanks to create a variable with a default value in Terraform.
variable "region" { type = [1] default = [2] }
The variable type is string and the default region is "us-west-2".
Fill all three blanks to create a resource with tags in Terraform.
resource "aws_s3_bucket" "bucket" { bucket = [1] acl = [2] tags = { Name = [3] } }
The bucket name must be unique, acl is set to "private" for security, and tags include a friendly name.