terraform-google-kubernetes-engine icon indicating copy to clipboard operation
terraform-google-kubernetes-engine copied to clipboard

var.network and var.subnetwork are not used in cluster.tf

Open lgandras opened this issue 5 years ago • 1 comments
trafficstars

I don't know if this is the intended behaviour, but if you don't initialize the google provider and you don't specify the region (regional = false), the main example in the README.md will fail with:

Error: Invalid template interpolation value

  on .terraform/modules/gke/terraform-google-kubernetes-engine-9.3.0/cluster.tf line 45, in resource "google_container_cluster" "primary":
  45:   subnetwork = "projects/${local.network_project_id}/regions/${var.region}/subnetworks/${var.subnetwork}"
    |----------------
    | var.region is null

The expression result is null. Cannot include a null value in a string
template.

The documentation says that the region parameter is optional when specifying a zonal cluster.

lgandras avatar Jun 11 '20 21:06 lgandras

Yeah we should change the var.region call there to a local.region which pulls the region from zone if region is null.

morgante avatar Jun 11 '20 21:06 morgante