Complete the code to define an AWS S3 bucket resource with the name 'my_bucket'.
resource "aws_s3_bucket" "[1]" { bucket = "my-unique-bucket-name" }
The resource name inside quotes is an identifier used to reference this resource in Terraform. 'my_bucket' is a clear and valid name.
Complete the code to specify the AWS provider version in Terraform.
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "[1]"
}
}
}The version constraint '~> 4.0' means any version from 4.0 up to but not including 5.0, which is a common best practice.
Fix the error in the resource block by completing the missing attribute for the AWS EC2 instance type.
resource "aws_instance" "example" { ami = "ami-0c55b159cbfafe1f0" [1] = "t2.micro" }
The correct attribute to specify the EC2 instance size is 'instance_type'.
Fill both blanks to create a resource block for an AWS security group with a description and a name.
resource "aws_security_group" "[1]" { name = "[2]" description = "Allow SSH access" }
The resource name is 'ssh_sg' and the security group name is 'ssh-access', which clearly describe the purpose.
Fill all three blanks to define an AWS IAM user resource with a name, path, and tags.
resource "aws_iam_user" "[1]" { name = "[2]" path = "[3]" tags = { Environment = "Dev" } }
The resource name is 'dev_user', the IAM user name is 'developer', and the path is '/dev/' which organizes users under the dev folder.