How to Produce a Transit Entrance with Attachments in Terraform

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

 company "aws" {

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

# Produce 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.
vpc_id="vpc-xyz789" # ID of the VPC to connect.

# Produce a VPN accessory.
resource "aws_ec2_transit_gateway_vpn_attachment" "example_vpn_attachment" {
transit_gateway_id = aws_ec2_transit_gateway.
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 produce a transit entrance in the us-west-2 area. We’re defining a description criterion to offer 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 produce 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 criterion, and the ID of the VPC to connect with the vpc_id criterion. For the VPN accessory, we’re defining the ID of the VPN connection to connect with the vpn_connection_id criterion.

Keep In Mind that in both cases, we’re referencing the id characteristic of the transit entrance resource developed previously with the aws_ec2_transit_gateway. syntax, which guarantees that the accessories are developed on the appropriate 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: :???: :?: :!: