We have reserved static (whitelisted) IP addresses that need to be assigned to a CloudNAT on GCP by terraform. The IPs are reserved and registered with a service provider, which takes weeks to get approved and added to their firewalls, so dynamic allocation is not an option.

The main problem for us is that the google\_compute\_router\_nat section requires the nat\_ip\_allocate\_option, but in this case the IP address has already been allocated, so it fails with an error stating exactly that. The only options for allocate are AUTO\_ONLY and MANUAL\_ONLY, but it seems maybe an EXISTING or RESERVED might be needed, unless I'm missing something obvious.

Here is the failing configuration:

```
resource "google_compute_address" "static_ip" {
  name    = "whitelisted-static-ip"
  region  = "${var.project_region}"
}

resource "google_compute_router_nat" "cluster-nat" {
  name                               = "cluster-stg-nat"
  router                             = "${google_compute_router.router.name}"
  region                             = "${google_compute_router.router.region}"
  nat_ip_allocate_option             = "MANUAL_ONLY"
  nat_ips                            = ["${google_compute_address.static_ip.self_link}"]
  source_subnetwork_ip_ranges_to_nat = "LIST_OF_SUBNETWORKS"
  subnetwork {
    name                    = "${google_compute_subnetwork.service.self_link}"
    source_ip_ranges_to_nat = ["ALL_IP_RANGES"]
  }
}

```

Results in the following error:

```
Error: Error creating Address: googleapi: Error 409: The resource 'projects/staging-cluster/regions/us-central1/addresses/whitelisted-static-ip' already exists, alreadyExists

```

because the static IP resource is already reserved in GCP External IP Addresses and registered with the service provider.