Google cloud platform 通过Terraform提供没有外部IP的GCP VM实例

Google cloud platform 通过Terraform提供没有外部IP的GCP VM实例,google-cloud-platform,terraform-provider-gcp,Google Cloud Platform,Terraform Provider Gcp,试图通过terraform在GCP中创建一个外部IP为None的VM network_interface { network = "projects/other-project-name/global/networks/network-name" subnetwork = "projects/other-project-name/regions/us-central1/subnetworks/subnet-name" access_config

试图通过terraform在GCP中创建一个外部IP为None的VM

network_interface {
  network = "projects/other-project-name/global/networks/network-name"
  subnetwork = "projects/other-project-name/regions/us-central1/subnetworks/subnet-name"
  access_config {
    nat_ip = "None"
  }
}  
但是
nat_ip=“None”
对于该字段是无效的值。如果我做了
nat_ip=”“
,它会自动分配外部ip。

以下是他们的文档:

要通过terraform在GCP中创建一个虚拟机,而无需外部IP,您只需省略
网络接口
块中的
访问配置
部分即可。所以你应该:

network_interface {
  network = "projects/other-project-name/global/networks/network-name"
  subnetwork = "projects/other-project-name/regions/us-central1/subnetworks/subnet-name"
}