I am working to convert a CloudFormation into Terraform. I am currently unable to find an equivalent resource for AWS::EC2::VPCGatewayAttachment
.
This is the original:
AgentVPC:
Type: AWS::EC2::VPC
Properties:
CidrBlock: 10.0.0.0/16
EnableDnsSupport: 'true'
EnableDnsHostnames: 'true'
InternetGateway:
Type: AWS::EC2::InternetGateway
DependsOn: AgentVPC
AttachGateway:
Type: AWS::EC2::VPCGatewayAttachment
Properties:
VpcId:
Ref: AgentVPC
InternetGatewayId:
Ref: InternetGateway
And this is what I have so far:
resource "aws_vpc" "agent_vpc" {
cidr_block = "10.0.0.0/16"
enable_dns_support = true
enable_dns_hostnames = true
}
resource "aws_internet_gateway" "internet_gateway" {
depends_on = [
aws_vpc.agent_vpc
]
}
But what is the terraform equivalent for that VPCGatewayAttachment
? I can only find VPN attachment, which is not what I want (and which doesn't work).
Thank you!
Just solved this. Turns out that aws_inte.net_gateway
can just take the VPC directly, like so:
resource "aws_internet_gateway" "internet_gateway" {
vpc_id = aws_vpc.agent_vpc.id
}
At which point the need for VPCGatewayAttachment
disappears.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.