Google compute engine 使用terraform获取为特定接口创建的google实例的外部IP

Google compute engine 使用terraform获取为特定接口创建的google实例的外部IP,google-compute-engine,terraform,Google Compute Engine,Terraform,我正在使用terraform创建和配置我的GCE实例。我已经在GCE接口上配置了4个接口,现在我希望使用terraform为这个实例配置Management接口的外部IP 对于aws,我们有一些 output "ip" { value = "${aws_eip.ip.public_ip}" } 所以我想知道我是否可以用GCE来做这个。简而言之,我希望将创建实例的外部IP存储在本地实例上,最好是存储在变量中我使用输出变量在实例创建期间计算IP output "mgt0ip" { valu

我正在使用terraform创建和配置我的GCE实例。我已经在GCE接口上配置了4个接口,现在我希望使用terraform为这个实例配置Management接口的外部IP

对于aws,我们有一些

output "ip" {
  value = "${aws_eip.ip.public_ip}"
}

所以我想知道我是否可以用GCE来做这个。简而言之,我希望将创建实例的外部IP存储在本地实例上,最好是存储在变量中

我使用输出变量在实例创建期间计算IP

output "mgt0ip" {
  value = "${google_compute_instance.default.network_interface.0.access_config.0.nat_ip}"
}