【问题标题】:How can I use shared VPC GCP in Terraform config?如何在 Terraform 配置中使用共享 VPC GCP?
【发布时间】:2019-02-16 07:49:28
【问题描述】:

我在 GCP 中配置了共享 VPC,我想知道如何在我的 terrafrom 中使用它。

在使用共享VPC之前,我的terraform network_interface部分如下:

network_interface {
    network     = "default"
    address     = "10.128.0.5"
    access_config {
      //nat_ip    = "xxx.xxx.xxx.xx"
    }
  }

我想知道是否有人可以指导我。

真的很感激。

谢谢!

-劳伦特

【问题讨论】:

    标签: terraform terraform-provider-gcp


    【解决方案1】:

    我没有尝试使用 terraform,但我很确定您可以按照示例使用共享 VPC:https://github.com/terraform-providers/terraform-provider-google/tree/master/examples/shared-vpc

    您的网络接口应如下所示:

    network_interface {
      network = "${google_compute_network.shared_network.self_link}"
      access_config {
        nat_ip = "..."
      }
    }
    

    您需要使用固定的内部 IP(通过字段地址)还是可以使用自动受影响的地址?如果不能,则必须将地址图保存在某处,以确保不会影响已受影响的地址。

    NAT IP 应该不会引起问题,但您知道...最好的答案是尝试一下;)

    【讨论】:

      猜你喜欢
      • 2021-09-02
      • 1970-01-01
      • 2019-08-17
      • 1970-01-01
      • 2022-01-21
      • 2021-05-24
      • 2021-08-09
      • 2019-07-14
      • 1970-01-01
      相关资源
      最近更新 更多