I’m having a heck of time getting a Composer environment spun up using terraform. I keep getting a networking error about the CIDR range not being available. Any help or suggestions would be greatly appreciated.
Error waiting to create Environment: Error waiting for Creating Environment: Error code 3, message: CREATE operation failed. Polled operation status: DONE: Requested CIDR 10.221.128.0/17 for pods is not available in network "xxxxxxx" for cluster {Zone=us-west1, ProjectNum=xxxxxxxxxxxxx, ClusterHash=xxxxxxxxxxxxxx}.
locals {
subnetwork_cidr_block = "10.220.0.0/20"
subnetwork_pod_cidr_block = "10.221.128.0/17"
subnetwork_svc_cidr_block = "10.222.0.0/22"
}
resource "google_compute_subnetwork" "composer" {
name = "${var.app_env}-${var.app}-composer"
ip_cidr_range = local.subnetwork_cidr_block
region = var.region
network = google_compute_network.composer.id
private_ip_google_access = true
secondary_ip_range {
range_name = "${var.app_env}-${var.app}-composer-gke-${var.region}-gke-pods"
ip_cidr_range = local.subnetwork_pod_cidr_block
}
secondary_ip_range {
range_name = "${var.app_env}-${var.app}-composer-gke-${var.region}-gke-services"
ip_cidr_range = local.subnetwork_svc_cidr_block
}
}
...
Node Config of composer environment block:
config {
node_config {
network = google_compute_network.composer.id
subnetwork = google_compute_subnetwork.composer.id
service_account = data.google_service_account.composer.name
ip_allocation_policy {
cluster_ipv4_cidr_block = local.subnetwork_pod_cidr_block
services_ipv4_cidr_block = local.subnetwork_svc_cidr_block
}
}