I would like to deploy a Google Cloud Compute Engine VM instance with Terraform 0.12. My problem is that 2 IP addresses are created. I have a static and an ephemeral IP address. The VM instance is using the ephemeral IP. The zone is correct.
This is the code that I'm using:
resource "google_compute_address" "static-ip" {
name = "static-ip"
address_type = "EXTERNAL"
region = var.location
}
Inside the Compute Engine VM instance, in google_compute_instance_template,
the network is configured this way:
network_interface {
network = "default-net"
access_config {
nat_ip = google_compute_address.static-ip.address
}
}
After that, I instantiate the VM instance with the resource google_compute_instance_from_template.
I was wondering, how can I attach the external IP to my VM instance and only have one IP address?