我可以通过以下代码向实例添加外部IP。
network_interface {
subnetwork = "${europe-staging-subnetwork.self_link}"
access_config {
nat_ip = "${google_compute_address.external_ip.address}"
}
}
resource "google_compute_network" "staging-network" {
name = "staging-network"
auto_create_subnetworks = "false"
}
resource "google_compute_subnetwork" "europe-staging-subnetwork" {
name = "europe-staging-subnetwork"
region = "europe-west1"
ip_cidr_range = "#.#.#.#/16"
network = "${google_compute_network.staging-network.self_link}"
}
但是如何为实例分配多个外部IP?
答案 0 :(得分:0)
您可以使用multiple network interfaces来拥有多个外部IP。需要在creating the instance期间以及在创建实例后的cannot be modified or deleted期间配置网络接口。