【发布时间】:2021-07-29 02:23:30
【问题描述】:
我正在尝试使用 Terraform 构建 VPC 资源以提供 MWAA 构建。在 AWS 文档中,我看到以下资源(除了子网等)被定义为创建一个完整的 VPC 环境。我已经使用 Terraform 定义了 aws_vpc 和 aws_internet_gateway,但找不到 InternetGatewayAttachment 的 Terraform 模板 - 仅 用于 aws_vpn_gateway_attachment。
- 如何将 VPC 资源附加到带 Terraform 的 IGW?
- 我需要一个资源,还是 TF aws_internet_gateway 资源定义中隐含的 vpc_id?
P。 S. - 我来自 GCP,而不是超级熟悉 AWS 网络概念。
Resources:
VPC:
Type: AWS::EC2::VPC
Properties:
CidrBlock: !Ref VpcCIDR
EnableDnsSupport: true
EnableDnsHostnames: true
Tags:
- Key: Name
Value: !Ref EnvironmentName
InternetGateway:
Type: AWS::EC2::InternetGateway
Properties:
Tags:
- Key: Name
Value: !Ref EnvironmentName
InternetGatewayAttachment:
Type: AWS::EC2::VPCGatewayAttachment
Properties:
InternetGatewayId: !Ref InternetGateway
VpcId: !Ref VPC
....
【问题讨论】:
-
为什么在关于 Terraform 的问题中包含 CloudFormation 模板?
标签: amazon-web-services terraform terraform-provider-aws