From fc34eb64a1bc117503573894353854a32ff88402 Mon Sep 17 00:00:00 2001 From: Marco Ferrari Date: Wed, 5 May 2021 15:10:59 +0200 Subject: [PATCH] fix: Add cluster ID to outputs (#886) --- README.md | 1 + autogen/main/main.tf.tmpl | 3 +++ autogen/main/outputs.tf.tmpl | 5 +++++ autogen/safer-cluster/outputs.tf.tmpl | 5 +++++ main.tf | 3 +++ modules/beta-private-cluster-update-variant/README.md | 1 + modules/beta-private-cluster-update-variant/main.tf | 3 +++ modules/beta-private-cluster-update-variant/outputs.tf | 5 +++++ modules/beta-private-cluster/README.md | 1 + modules/beta-private-cluster/main.tf | 3 +++ modules/beta-private-cluster/outputs.tf | 5 +++++ modules/beta-public-cluster-update-variant/README.md | 1 + modules/beta-public-cluster-update-variant/main.tf | 3 +++ modules/beta-public-cluster-update-variant/outputs.tf | 5 +++++ modules/beta-public-cluster/README.md | 1 + modules/beta-public-cluster/main.tf | 3 +++ modules/beta-public-cluster/outputs.tf | 5 +++++ modules/private-cluster-update-variant/README.md | 1 + modules/private-cluster-update-variant/main.tf | 3 +++ modules/private-cluster-update-variant/outputs.tf | 5 +++++ modules/private-cluster/README.md | 1 + modules/private-cluster/main.tf | 3 +++ modules/private-cluster/outputs.tf | 5 +++++ modules/safer-cluster-update-variant/README.md | 1 + modules/safer-cluster-update-variant/outputs.tf | 5 +++++ modules/safer-cluster/README.md | 1 + modules/safer-cluster/outputs.tf | 5 +++++ outputs.tf | 5 +++++ 28 files changed, 88 insertions(+) diff --git a/README.md b/README.md index 41b163e19..af5273804 100644 --- a/README.md +++ b/README.md @@ -195,6 +195,7 @@ Then perform the following commands on the root folder: | Name | Description | |------|-------------| | ca\_certificate | Cluster ca certificate (base64 encoded) | +| cluster\_id | Cluster ID | | endpoint | Cluster endpoint | | horizontal\_pod\_autoscaling\_enabled | Whether horizontal pod autoscaling enabled | | http\_load\_balancing\_enabled | Whether http load balancing enabled | diff --git a/autogen/main/main.tf.tmpl b/autogen/main/main.tf.tmpl index 2dc3d75d6..57f0c851f 100644 --- a/autogen/main/main.tf.tmpl +++ b/autogen/main/main.tf.tmpl @@ -36,6 +36,9 @@ resource "random_shuffle" "available_zones" { } locals { + // ID of the cluster + cluster_id = google_container_cluster.primary.id + // location location = var.regional ? var.region : var.zones[0] region = var.regional ? var.region : join("-", slice(split("-", var.zones[0]), 0, 2)) diff --git a/autogen/main/outputs.tf.tmpl b/autogen/main/outputs.tf.tmpl index 0459a9218..fd58ec9c2 100644 --- a/autogen/main/outputs.tf.tmpl +++ b/autogen/main/outputs.tf.tmpl @@ -16,6 +16,11 @@ {{ autogeneration_note }} +output "cluster_id" { + description = "Cluster ID" + value = local.cluster_id +} + output "name" { description = "Cluster name" value = local.cluster_name diff --git a/autogen/safer-cluster/outputs.tf.tmpl b/autogen/safer-cluster/outputs.tf.tmpl index 1b5dd628c..3769eab06 100644 --- a/autogen/safer-cluster/outputs.tf.tmpl +++ b/autogen/safer-cluster/outputs.tf.tmpl @@ -16,6 +16,11 @@ {{ autogeneration_note }} +output "cluster_id" { + description = "Cluster ID" + value = module.gke.cluster_id +} + output "name" { description = "Cluster name" value = module.gke.name diff --git a/main.tf b/main.tf index a8feef217..0ca482955 100644 --- a/main.tf +++ b/main.tf @@ -32,6 +32,9 @@ resource "random_shuffle" "available_zones" { } locals { + // ID of the cluster + cluster_id = google_container_cluster.primary.id + // location location = var.regional ? var.region : var.zones[0] region = var.regional ? var.region : join("-", slice(split("-", var.zones[0]), 0, 2)) diff --git a/modules/beta-private-cluster-update-variant/README.md b/modules/beta-private-cluster-update-variant/README.md index 863a6e537..b779cf71d 100644 --- a/modules/beta-private-cluster-update-variant/README.md +++ b/modules/beta-private-cluster-update-variant/README.md @@ -253,6 +253,7 @@ Then perform the following commands on the root folder: |------|-------------| | ca\_certificate | Cluster ca certificate (base64 encoded) | | cloudrun\_enabled | Whether CloudRun enabled | +| cluster\_id | Cluster ID | | dns\_cache\_enabled | Whether DNS Cache enabled | | endpoint | Cluster endpoint | | horizontal\_pod\_autoscaling\_enabled | Whether horizontal pod autoscaling enabled | diff --git a/modules/beta-private-cluster-update-variant/main.tf b/modules/beta-private-cluster-update-variant/main.tf index fc3da46c8..cf6a0a49d 100644 --- a/modules/beta-private-cluster-update-variant/main.tf +++ b/modules/beta-private-cluster-update-variant/main.tf @@ -32,6 +32,9 @@ resource "random_shuffle" "available_zones" { } locals { + // ID of the cluster + cluster_id = google_container_cluster.primary.id + // location location = var.regional ? var.region : var.zones[0] region = var.regional ? var.region : join("-", slice(split("-", var.zones[0]), 0, 2)) diff --git a/modules/beta-private-cluster-update-variant/outputs.tf b/modules/beta-private-cluster-update-variant/outputs.tf index 6c1d8ce9d..b60db783d 100644 --- a/modules/beta-private-cluster-update-variant/outputs.tf +++ b/modules/beta-private-cluster-update-variant/outputs.tf @@ -16,6 +16,11 @@ // This file was automatically generated from a template in ./autogen/main +output "cluster_id" { + description = "Cluster ID" + value = local.cluster_id +} + output "name" { description = "Cluster name" value = local.cluster_name diff --git a/modules/beta-private-cluster/README.md b/modules/beta-private-cluster/README.md index b402f22e7..fc2a207a3 100644 --- a/modules/beta-private-cluster/README.md +++ b/modules/beta-private-cluster/README.md @@ -231,6 +231,7 @@ Then perform the following commands on the root folder: |------|-------------| | ca\_certificate | Cluster ca certificate (base64 encoded) | | cloudrun\_enabled | Whether CloudRun enabled | +| cluster\_id | Cluster ID | | dns\_cache\_enabled | Whether DNS Cache enabled | | endpoint | Cluster endpoint | | horizontal\_pod\_autoscaling\_enabled | Whether horizontal pod autoscaling enabled | diff --git a/modules/beta-private-cluster/main.tf b/modules/beta-private-cluster/main.tf index fc3da46c8..cf6a0a49d 100644 --- a/modules/beta-private-cluster/main.tf +++ b/modules/beta-private-cluster/main.tf @@ -32,6 +32,9 @@ resource "random_shuffle" "available_zones" { } locals { + // ID of the cluster + cluster_id = google_container_cluster.primary.id + // location location = var.regional ? var.region : var.zones[0] region = var.regional ? var.region : join("-", slice(split("-", var.zones[0]), 0, 2)) diff --git a/modules/beta-private-cluster/outputs.tf b/modules/beta-private-cluster/outputs.tf index 6c1d8ce9d..b60db783d 100644 --- a/modules/beta-private-cluster/outputs.tf +++ b/modules/beta-private-cluster/outputs.tf @@ -16,6 +16,11 @@ // This file was automatically generated from a template in ./autogen/main +output "cluster_id" { + description = "Cluster ID" + value = local.cluster_id +} + output "name" { description = "Cluster name" value = local.cluster_name diff --git a/modules/beta-public-cluster-update-variant/README.md b/modules/beta-public-cluster-update-variant/README.md index d842e8b6c..8de63af33 100644 --- a/modules/beta-public-cluster-update-variant/README.md +++ b/modules/beta-public-cluster-update-variant/README.md @@ -242,6 +242,7 @@ Then perform the following commands on the root folder: |------|-------------| | ca\_certificate | Cluster ca certificate (base64 encoded) | | cloudrun\_enabled | Whether CloudRun enabled | +| cluster\_id | Cluster ID | | dns\_cache\_enabled | Whether DNS Cache enabled | | endpoint | Cluster endpoint | | horizontal\_pod\_autoscaling\_enabled | Whether horizontal pod autoscaling enabled | diff --git a/modules/beta-public-cluster-update-variant/main.tf b/modules/beta-public-cluster-update-variant/main.tf index eae4610b6..16b51545f 100644 --- a/modules/beta-public-cluster-update-variant/main.tf +++ b/modules/beta-public-cluster-update-variant/main.tf @@ -32,6 +32,9 @@ resource "random_shuffle" "available_zones" { } locals { + // ID of the cluster + cluster_id = google_container_cluster.primary.id + // location location = var.regional ? var.region : var.zones[0] region = var.regional ? var.region : join("-", slice(split("-", var.zones[0]), 0, 2)) diff --git a/modules/beta-public-cluster-update-variant/outputs.tf b/modules/beta-public-cluster-update-variant/outputs.tf index e367d56e4..4f92d3561 100644 --- a/modules/beta-public-cluster-update-variant/outputs.tf +++ b/modules/beta-public-cluster-update-variant/outputs.tf @@ -16,6 +16,11 @@ // This file was automatically generated from a template in ./autogen/main +output "cluster_id" { + description = "Cluster ID" + value = local.cluster_id +} + output "name" { description = "Cluster name" value = local.cluster_name diff --git a/modules/beta-public-cluster/README.md b/modules/beta-public-cluster/README.md index 0520611df..73d416f82 100644 --- a/modules/beta-public-cluster/README.md +++ b/modules/beta-public-cluster/README.md @@ -220,6 +220,7 @@ Then perform the following commands on the root folder: |------|-------------| | ca\_certificate | Cluster ca certificate (base64 encoded) | | cloudrun\_enabled | Whether CloudRun enabled | +| cluster\_id | Cluster ID | | dns\_cache\_enabled | Whether DNS Cache enabled | | endpoint | Cluster endpoint | | horizontal\_pod\_autoscaling\_enabled | Whether horizontal pod autoscaling enabled | diff --git a/modules/beta-public-cluster/main.tf b/modules/beta-public-cluster/main.tf index eae4610b6..16b51545f 100644 --- a/modules/beta-public-cluster/main.tf +++ b/modules/beta-public-cluster/main.tf @@ -32,6 +32,9 @@ resource "random_shuffle" "available_zones" { } locals { + // ID of the cluster + cluster_id = google_container_cluster.primary.id + // location location = var.regional ? var.region : var.zones[0] region = var.regional ? var.region : join("-", slice(split("-", var.zones[0]), 0, 2)) diff --git a/modules/beta-public-cluster/outputs.tf b/modules/beta-public-cluster/outputs.tf index e367d56e4..4f92d3561 100644 --- a/modules/beta-public-cluster/outputs.tf +++ b/modules/beta-public-cluster/outputs.tf @@ -16,6 +16,11 @@ // This file was automatically generated from a template in ./autogen/main +output "cluster_id" { + description = "Cluster ID" + value = local.cluster_id +} + output "name" { description = "Cluster name" value = local.cluster_name diff --git a/modules/private-cluster-update-variant/README.md b/modules/private-cluster-update-variant/README.md index 759039a42..0e4dbc4b9 100644 --- a/modules/private-cluster-update-variant/README.md +++ b/modules/private-cluster-update-variant/README.md @@ -227,6 +227,7 @@ Then perform the following commands on the root folder: | Name | Description | |------|-------------| | ca\_certificate | Cluster ca certificate (base64 encoded) | +| cluster\_id | Cluster ID | | endpoint | Cluster endpoint | | horizontal\_pod\_autoscaling\_enabled | Whether horizontal pod autoscaling enabled | | http\_load\_balancing\_enabled | Whether http load balancing enabled | diff --git a/modules/private-cluster-update-variant/main.tf b/modules/private-cluster-update-variant/main.tf index d645f2554..e03b883f9 100644 --- a/modules/private-cluster-update-variant/main.tf +++ b/modules/private-cluster-update-variant/main.tf @@ -32,6 +32,9 @@ resource "random_shuffle" "available_zones" { } locals { + // ID of the cluster + cluster_id = google_container_cluster.primary.id + // location location = var.regional ? var.region : var.zones[0] region = var.regional ? var.region : join("-", slice(split("-", var.zones[0]), 0, 2)) diff --git a/modules/private-cluster-update-variant/outputs.tf b/modules/private-cluster-update-variant/outputs.tf index 1bb6d92dd..1f0bbeaaf 100644 --- a/modules/private-cluster-update-variant/outputs.tf +++ b/modules/private-cluster-update-variant/outputs.tf @@ -16,6 +16,11 @@ // This file was automatically generated from a template in ./autogen/main +output "cluster_id" { + description = "Cluster ID" + value = local.cluster_id +} + output "name" { description = "Cluster name" value = local.cluster_name diff --git a/modules/private-cluster/README.md b/modules/private-cluster/README.md index 6e35b68ec..505a72a96 100644 --- a/modules/private-cluster/README.md +++ b/modules/private-cluster/README.md @@ -205,6 +205,7 @@ Then perform the following commands on the root folder: | Name | Description | |------|-------------| | ca\_certificate | Cluster ca certificate (base64 encoded) | +| cluster\_id | Cluster ID | | endpoint | Cluster endpoint | | horizontal\_pod\_autoscaling\_enabled | Whether horizontal pod autoscaling enabled | | http\_load\_balancing\_enabled | Whether http load balancing enabled | diff --git a/modules/private-cluster/main.tf b/modules/private-cluster/main.tf index d645f2554..e03b883f9 100644 --- a/modules/private-cluster/main.tf +++ b/modules/private-cluster/main.tf @@ -32,6 +32,9 @@ resource "random_shuffle" "available_zones" { } locals { + // ID of the cluster + cluster_id = google_container_cluster.primary.id + // location location = var.regional ? var.region : var.zones[0] region = var.regional ? var.region : join("-", slice(split("-", var.zones[0]), 0, 2)) diff --git a/modules/private-cluster/outputs.tf b/modules/private-cluster/outputs.tf index 1bb6d92dd..1f0bbeaaf 100644 --- a/modules/private-cluster/outputs.tf +++ b/modules/private-cluster/outputs.tf @@ -16,6 +16,11 @@ // This file was automatically generated from a template in ./autogen/main +output "cluster_id" { + description = "Cluster ID" + value = local.cluster_id +} + output "name" { description = "Cluster name" value = local.cluster_name diff --git a/modules/safer-cluster-update-variant/README.md b/modules/safer-cluster-update-variant/README.md index 6b9392b65..0508e75bf 100644 --- a/modules/safer-cluster-update-variant/README.md +++ b/modules/safer-cluster-update-variant/README.md @@ -264,6 +264,7 @@ For simplicity, we suggest using `roles/container.admin` and | Name | Description | |------|-------------| | ca\_certificate | Cluster ca certificate (base64 encoded) | +| cluster\_id | Cluster ID | | endpoint | Cluster endpoint | | horizontal\_pod\_autoscaling\_enabled | Whether horizontal pod autoscaling enabled | | http\_load\_balancing\_enabled | Whether http load balancing enabled | diff --git a/modules/safer-cluster-update-variant/outputs.tf b/modules/safer-cluster-update-variant/outputs.tf index c915cf1e9..8ad86f38f 100644 --- a/modules/safer-cluster-update-variant/outputs.tf +++ b/modules/safer-cluster-update-variant/outputs.tf @@ -16,6 +16,11 @@ // This file was automatically generated from a template in ./autogen/safer-cluster +output "cluster_id" { + description = "Cluster ID" + value = module.gke.cluster_id +} + output "name" { description = "Cluster name" value = module.gke.name diff --git a/modules/safer-cluster/README.md b/modules/safer-cluster/README.md index 6b9392b65..0508e75bf 100644 --- a/modules/safer-cluster/README.md +++ b/modules/safer-cluster/README.md @@ -264,6 +264,7 @@ For simplicity, we suggest using `roles/container.admin` and | Name | Description | |------|-------------| | ca\_certificate | Cluster ca certificate (base64 encoded) | +| cluster\_id | Cluster ID | | endpoint | Cluster endpoint | | horizontal\_pod\_autoscaling\_enabled | Whether horizontal pod autoscaling enabled | | http\_load\_balancing\_enabled | Whether http load balancing enabled | diff --git a/modules/safer-cluster/outputs.tf b/modules/safer-cluster/outputs.tf index c915cf1e9..8ad86f38f 100644 --- a/modules/safer-cluster/outputs.tf +++ b/modules/safer-cluster/outputs.tf @@ -16,6 +16,11 @@ // This file was automatically generated from a template in ./autogen/safer-cluster +output "cluster_id" { + description = "Cluster ID" + value = module.gke.cluster_id +} + output "name" { description = "Cluster name" value = module.gke.name diff --git a/outputs.tf b/outputs.tf index d6df34d8c..bd48ce34c 100644 --- a/outputs.tf +++ b/outputs.tf @@ -16,6 +16,11 @@ // This file was automatically generated from a template in ./autogen/main +output "cluster_id" { + description = "Cluster ID" + value = local.cluster_id +} + output "name" { description = "Cluster name" value = local.cluster_name