I want connect my "private" network (instances without external IP's) via terraform.
- google_compute_router_nat.advanced-nat: Error patching router us-west2/my-router1: googleapi: Error 400: Invalid value for field 'resource.nats[0].subnetworks[0].name': 'test-us-west2-private-subnet'. The URL is malformed. More details: Reason: invalid, Message: Invalid value for field 'resource.nats[0].subnetworks[0].name': 'test-us-west2-private-subnet'. The URL is malformed. Reason: invalid, Message: Invalid value for field 'resource.nats[0].natIps[0]': '10.0.0.0/16'. The URL is malformed.
Task: migrate classic scheme from AWS to GCP: One VPC Network, Bastion Host in Public Network, in Private network all machines without external IP's. Use NAT Gateway for Private Network.
resource "google_compute_router" "router" {
name = "my-router1"
network = "${var.gcp_project_name}-net"
bgp {
asn = 64514
}
}
resource "google_compute_router_nat" "advanced-nat" {
name = "nat-1"
router = "${google_compute_router.router.name}"
region = "us-west2"
nat_ip_allocate_option = "MANUAL_ONLY"
nat_ips = ["10.0.0.0/16"]
source_subnetwork_ip_ranges_to_nat = "LIST_OF_SUBNETWORKS"
subnetwork {
name = "${var.gcp_project_name}-${var.gcp_region_name}-private-subnet"
}
}
