Complete the code to define a VPC with a CIDR block of 10.0.0.0/16.
resource "aws_vpc" "main" { cidr_block = "[1]" }
The CIDR block 10.0.0.0/16 defines a private network range suitable for a VPC.
Complete the code to create a subnet with CIDR block 10.0.1.0/24 inside the VPC.
resource "aws_subnet" "subnet1" { vpc_id = aws_vpc.main.id cidr_block = "[1]" }
The subnet CIDR block 10.0.1.0/24 fits inside the VPC's 10.0.0.0/16 range.
Fix the error in the subnet CIDR block to be a valid subnet inside the VPC 10.0.0.0/16.
resource "aws_subnet" "subnet2" { vpc_id = aws_vpc.main.id cidr_block = "[1]" }
The subnet 10.0.2.0/24 is valid inside the VPC 10.0.0.0/16. The option 10.1.0.0/16 is outside the VPC range.
Fill both blanks to create a subnet with 512 IP addresses inside the VPC 10.0.0.0/16.
resource "aws_subnet" "subnet3" { vpc_id = aws_vpc.main.id cidr_block = "[1]" availability_zone = "[2]" }
A /23 subnet has 512 IP addresses, and us-east-1a is a valid availability zone.
Fill all three blanks to define a route table with a route to the internet gateway for the VPC 10.0.0.0/16.
resource "aws_route_table" "rt" { vpc_id = aws_vpc.main.id route { cidr_block = "[1]" gateway_id = aws_internet_gateway.[2].id depends_on = [aws_internet_gateway.[3]] } }
The route to 0.0.0.0/0 sends all traffic to the internet gateway. The gateway_id and depends_on must reference the correct internet gateway resource name.