簡體   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