locals { kubeconfig_name = "gke_${google_container_cluster.cluster.project}_${google_container_cluster.cluster.location}_${google_container_cluster.cluster.name}" kubeconfig_yaml = yamlencode(local.kubeconfig) kubeconfig = { apiVersion = "v1" kind = "Config" preferences = {} clusters = [ { name = local.kubeconfig_name cluster = { server = "https://${google_container_cluster.cluster.control_plane_endpoints_config[0].dns_endpoint_config[0].endpoint}" } } ] contexts = [ { name = local.kubeconfig_name context = { cluster = local.kubeconfig_name user = local.kubeconfig_name } } ] current-context = local.kubeconfig_name users = [ { name = local.kubeconfig_name user = { exec = { apiVersion = "client.authentication.k8s.io/v1beta1" command = "gke-gcloud-auth-plugin" provideClusterInfo = true installHint = <