Develop Transit Entrance with Attachments in Terraform

The copying Terraform code bit develops a Transit Entrance with VPC and VPN accessories:

 service provider "aws" {
area="us-west-2".
}

# Develop a transit entrance.
resource "aws_ec2_transit_gateway" "example" {
description="Example transit entrance".
}

# Develop a VPC accessory.
resource "aws_ec2_transit_gateway_vpc_attachment" "example_vpc_attachment" {
subnet_ids = ["subnet-abc123", "subnet-def456"] # IDs of the subnets in the VPC to connect.
transit_gateway_id = aws_ec2_transit_gateway. example.id.
vpc_id="vpc-xyz789" # ID of the VPC to connect.
}

# Develop a VPN accessory.
resource "aws_ec2_transit_gateway_vpn_attachment" "example_vpn_attachment" {
transit_gateway_id = aws_ec2_transit_gateway. example.id.
vpn_connection_id="vpn-123456" # ID of the VPN connection to connect.
}

In this example, we’re utilizing the aws_ec2_transit_gateway resource type to develop a transit entrance in the us-west-2 area. We’re defining a description specification to supply a description for the transit entrance.

We’re likewise utilizing the aws_ec2_transit_gateway_vpc_attachment and aws_ec2_transit_gateway_vpn_attachment resource types to develop VPC and VPN accessories, respectively. For the VPC accessory, we’re defining the IDs of the subnets in the VPC to connect with the subnet_ids specification, and the ID of the VPC to connect with the vpc_id specification. For the VPN accessory, we’re defining the ID of the VPN connection to connect with the vpn_connection_id specification.

Keep In Mind that in both cases, we’re referencing the id quality of the transit entrance resource produced previously with the aws_ec2_transit_gateway. example.id syntax, which makes sure that the accessories are produced on the proper transit entrance.

Like this post? Please share to your friends:
Leave a Reply

;-) :| :x :twisted: :smile: :shock: :sad: :roll: :razz: :oops: :o :mrgreen: :lol: :idea: :grin: :evil: :cry: :cool: :arrow: :???: :?: :!: