Complete the code to create a VPC peering connection between two VPCs.
resource "aws_vpc_peering_connection" "peer" { vpc_id = "[1]" peer_vpc_id = "vpc-0a1b2c3d4e5f6g7h8" peer_region = "us-west-2" }
vpc_id field.The vpc_id should be the ID of the requester VPC initiating the peering connection.
Complete the code to allow DNS resolution over the VPC peering connection.
resource "aws_vpc_peering_connection_options" "peer_options" { vpc_peering_connection_id = aws_vpc_peering_connection.peer.id requester { [1] = true } accepter { allow_dns_resolution_from_remote_vpc = true } }
The correct attribute to enable DNS resolution from the requester side is allow_dns_resolution_from_remote_vpc.
Fix the error in the VPC peering connection resource by completing the missing field.
resource "aws_vpc_peering_connection" "peer" { vpc_id = "vpc-123abc45" peer_vpc_id = "[1]" peer_owner_id = "123456789012" }
vpc_id and peer_vpc_id.peer_vpc_id field.The peer_vpc_id must be the ID of the VPC you want to peer with, different from the requester VPC.
Fill both blanks to configure route tables to allow traffic over the VPC peering connection.
resource "aws_route" "peer_route" { route_table_id = "[1]" destination_cidr_block = "[2]" vpc_peering_connection_id = aws_vpc_peering_connection.peer.id }
The route_table_id should be the route table of the VPC where you want to add the route. The destination_cidr_block is the CIDR block of the peer VPC.
Fill all three blanks to define a VPC peering connection with tags and accept the peering request.
resource "aws_vpc_peering_connection" "peer" { vpc_id = "[1]" peer_vpc_id = "[2]" auto_accept = [3] tags = { Name = "MyVPCPeering" } }
vpc_id and peer_vpc_id.auto_accept to false when automatic acceptance is desired.The vpc_id and peer_vpc_id specify the two VPCs to connect. Setting auto_accept to true means the peering request is automatically accepted.