【发布时间】:2019-05-05 08:01:59
【问题描述】:
我很擅长地形改造;事实上,这是我训练的一部分。
我想知道;有没有办法让 terraform 将上一个命令中的特定值(作为变量)存储在同一个文件中。
例子:
resource "aws_vpc" "TestVPC"{
cidr_block = "192.168.0.0/16"
instance_tenancy = "default"
enable_dns_hostnames="True"
tags{
Name="TestVpc"
}
}
resource "aws_subnet" "TestSubnet"{
vpc_id = "${var.aws_vpc_id}" ##This is where I'd like to populate the aws_vpc_id from the VPC creation step above.
cidr_block = "192.168.0.0/24"
map_public_ip_on_launch="True"
availability_zone = "us-east-2a"
tags{
Name="TestSubnet"
}
}
非常感谢您的帮助。
谢谢。
【问题讨论】:
标签: terraform infrastructure-as-code