简体   繁体   中英

How to assign multiple external IP to a google cloud instances using terraform

I am able to add an external IP to the instance by the following code.

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}"
}

But How will I assign multiple external IP to an instances?

You can use multiple network interfaces to have multiple external IPs. The network interfaces need to be configured while creating the instance and these cannot be modified or deleted after the instance has been created.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM