繁体   English   中英

Terraform 中的 VPCGatewayAttachment?

[英]VPCGatewayAttachment in Terraform?

我正在努力将 CloudFormation 转换为 Terraform。我目前无法找到AWS::EC2::VPCGatewayAttachment的等效资源。

这是原文:

  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

这就是我到目前为止所拥有的:

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
  ]
}

但是该VPCGatewayAttachment的 terraform 等价物是什么? 我只能找到 VPN 附件,这不是我想要的(而且不起作用)。

谢谢!

刚刚解决了这个问题。 事实证明aws_inte.net_gateway可以直接使用 VPC,如下所示:

resource "aws_internet_gateway" "internet_gateway" {
  vpc_id = aws_vpc.agent_vpc.id
}

此时不再需要VPCGatewayAttachment

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM