I'm trying to use the Terraform Module for GKE but I'm not sure how to configure the properties ip_range_pods
and ip_range_services
.
Specifically, I'm not sure how they derived these values:
ip_range_pods = "us-central1-01-gke-01-pods"
ip_range_services = "us-central1-01-gke-01-services"
The ip_range_pods
and ip_range_services
map to the ip_allocation_policy
cluster_secondary_range_name
and cluster_secondary_range_name
attributes of the google_container_cluster
resource as can be seen in the module source:
resource "google_container_cluster" "zonal_primary" {
# ...
ip_allocation_policy {
cluster_secondary_range_name = "${var.ip_range_pods}"
services_secondary_range_name = "${var.ip_range_services}"
}
}
These need to be existing ranges in a subnetwork such as created by the google_compute_subnetwork
resource:
resource "google_compute_subnetwork" "network-with-private-secondary-ip-ranges" {
name = "test-subnetwork"
ip_cidr_range = "10.2.0.0/16"
region = "us-central1"
network = "${google_compute_network.custom-test.self_link}"
secondary_ip_range {
range_name = "tf-test-secondary-range-update1"
ip_cidr_range = "192.168.10.0/24"
}
}
resource "google_compute_network" "custom-test" {
name = "test-network"
auto_create_subnetworks = false
}