Provisioning a GKE cluster using the public module
The Terraform kubernetes-engine
module – https://registry.terraform.io/modules/terraform-google-modules/kubernetes-engine/google/latest – is one of the more comprehensive (complex) Google Cloud Terraform modules. Our architecture calls for a zonal GKE cluster with a single configurable node pool for development and an equivalent but regional cluster for production. Thus, we start with the example in the README and modify it as per our needs. First, we remove features we don’t require, such as node pool labels and metadata. Next, we parameterize several attributes that differ depending on the environment. This includes the network and the configuration of the nodes in the node pool. We also include a Boolean variable, which indicates whether the cluster is a zonal or a regional cluster.
Finally, we set several fixed attributes that remain constant regardless of the environment in which the cluster is deployed...