From 8a62502bc06c95cc677a422e5fb1babf45e241a2 Mon Sep 17 00:00:00 2001 From: Ken Evensen Date: Tue, 23 Jul 2019 15:05:22 -0400 Subject: [PATCH] Changed the endpoint variable to be dependent on GKE cluster state --- autogen/outputs.tf | 14 ++++++++++++++ modules/beta-private-cluster/outputs.tf | 14 ++++++++++++++ modules/beta-public-cluster/outputs.tf | 14 ++++++++++++++ modules/private-cluster/outputs.tf | 13 +++++++++++++ outputs.tf | 13 +++++++++++++ 5 files changed, 68 insertions(+) diff --git a/autogen/outputs.tf b/autogen/outputs.tf index b88ee89593..bb0530f03b 100644 --- a/autogen/outputs.tf +++ b/autogen/outputs.tf @@ -45,6 +45,18 @@ output "endpoint" { sensitive = true description = "Cluster endpoint" value = local.cluster_endpoint + depends_on = [ + /* Nominally, the endpoint is populated as soon as it is known to Terraform. + * However, the cluster may not be in a usable state yet. Therefore any + * resources dependent on the cluster being up will fail to deploy. With + * this explicit dependency, dependent resources can wait for the cluster + * to be up. + */ + google_container_cluster.primary, + google_container_node_pool.pools, + google_container_cluster.zonal_primary, + google_container_node_pool.zonal_pools, + ] } output "min_master_version" { @@ -112,6 +124,7 @@ output "service_account" { description = "The service account to default running nodes as if not overridden in `node_pools`." value = local.service_account } + {% if beta_cluster %} output "istio_enabled" { @@ -128,4 +141,5 @@ output "pod_security_policy_enabled" { description = "Whether pod security policy is enabled" value = local.cluster_pod_security_policy_enabled } + {% endif %} diff --git a/modules/beta-private-cluster/outputs.tf b/modules/beta-private-cluster/outputs.tf index 3f5c5b10c9..7bd8147f92 100644 --- a/modules/beta-private-cluster/outputs.tf +++ b/modules/beta-private-cluster/outputs.tf @@ -45,6 +45,18 @@ output "endpoint" { sensitive = true description = "Cluster endpoint" value = local.cluster_endpoint + depends_on = [ + /* Nominally, the endpoint is populated as soon as it is known to Terraform. + * However, the cluster may not be in a usable state yet. Therefore any + * resources dependent on the cluster being up will fail to deploy. With + * this explicit dependency, dependent resources can wait for the cluster + * to be up. + */ + google_container_cluster.primary, + google_container_node_pool.pools, + google_container_cluster.zonal_primary, + google_container_node_pool.zonal_pools, + ] } output "min_master_version" { @@ -113,6 +125,7 @@ output "service_account" { value = local.service_account } + output "istio_enabled" { description = "Whether Istio is enabled" value = local.cluster_istio_enabled @@ -127,3 +140,4 @@ output "pod_security_policy_enabled" { description = "Whether pod security policy is enabled" value = local.cluster_pod_security_policy_enabled } + diff --git a/modules/beta-public-cluster/outputs.tf b/modules/beta-public-cluster/outputs.tf index 3f5c5b10c9..7bd8147f92 100644 --- a/modules/beta-public-cluster/outputs.tf +++ b/modules/beta-public-cluster/outputs.tf @@ -45,6 +45,18 @@ output "endpoint" { sensitive = true description = "Cluster endpoint" value = local.cluster_endpoint + depends_on = [ + /* Nominally, the endpoint is populated as soon as it is known to Terraform. + * However, the cluster may not be in a usable state yet. Therefore any + * resources dependent on the cluster being up will fail to deploy. With + * this explicit dependency, dependent resources can wait for the cluster + * to be up. + */ + google_container_cluster.primary, + google_container_node_pool.pools, + google_container_cluster.zonal_primary, + google_container_node_pool.zonal_pools, + ] } output "min_master_version" { @@ -113,6 +125,7 @@ output "service_account" { value = local.service_account } + output "istio_enabled" { description = "Whether Istio is enabled" value = local.cluster_istio_enabled @@ -127,3 +140,4 @@ output "pod_security_policy_enabled" { description = "Whether pod security policy is enabled" value = local.cluster_pod_security_policy_enabled } + diff --git a/modules/private-cluster/outputs.tf b/modules/private-cluster/outputs.tf index 433c2195ac..00784e958e 100644 --- a/modules/private-cluster/outputs.tf +++ b/modules/private-cluster/outputs.tf @@ -45,6 +45,18 @@ output "endpoint" { sensitive = true description = "Cluster endpoint" value = local.cluster_endpoint + depends_on = [ + /* Nominally, the endpoint is populated as soon as it is known to Terraform. + * However, the cluster may not be in a usable state yet. Therefore any + * resources dependent on the cluster being up will fail to deploy. With + * this explicit dependency, dependent resources can wait for the cluster + * to be up. + */ + google_container_cluster.primary, + google_container_node_pool.pools, + google_container_cluster.zonal_primary, + google_container_node_pool.zonal_pools, + ] } output "min_master_version" { @@ -112,3 +124,4 @@ output "service_account" { description = "The service account to default running nodes as if not overridden in `node_pools`." value = local.service_account } + diff --git a/outputs.tf b/outputs.tf index 433c2195ac..00784e958e 100644 --- a/outputs.tf +++ b/outputs.tf @@ -45,6 +45,18 @@ output "endpoint" { sensitive = true description = "Cluster endpoint" value = local.cluster_endpoint + depends_on = [ + /* Nominally, the endpoint is populated as soon as it is known to Terraform. + * However, the cluster may not be in a usable state yet. Therefore any + * resources dependent on the cluster being up will fail to deploy. With + * this explicit dependency, dependent resources can wait for the cluster + * to be up. + */ + google_container_cluster.primary, + google_container_node_pool.pools, + google_container_cluster.zonal_primary, + google_container_node_pool.zonal_pools, + ] } output "min_master_version" { @@ -112,3 +124,4 @@ output "service_account" { description = "The service account to default running nodes as if not overridden in `node_pools`." value = local.service_account } +