From a6b3f6e1bbd8bdbf844cf31f3b65891c5a6931b4 Mon Sep 17 00:00:00 2001
From: toddgiguere <83610458+toddgiguere@users.noreply.github.com>
Date: Mon, 9 Sep 2024 21:22:00 -0400
Subject: [PATCH] fix: added outputs for workload/management cluster names
(#875)
* fix: added outputs for cluster names
---
README.md | 2 ++
outputs.tf | 10 ++++++++++
patterns/roks/module/outputs.tf | 10 ++++++++++
patterns/roks/outputs.tf | 10 ++++++++++
4 files changed, 32 insertions(+)
diff --git a/README.md b/README.md
index bcd54d88..5ed8aebe 100644
--- a/README.md
+++ b/README.md
@@ -962,6 +962,7 @@ module "cluster_pattern" {
| [key\_map](#output\_key\_map) | Map of ids and keys for keys created |
| [key\_rings](#output\_key\_rings) | Key rings created by module |
| [management\_cluster\_id](#output\_management\_cluster\_id) | The id of the management cluster. If the cluster name does not exactly match the prefix-management-cluster pattern it will be null. |
+| [management\_cluster\_name](#output\_management\_cluster\_name) | The name of the management cluster. If the cluster name does not exactly match the prefix-management-cluster pattern it will be null. |
| [placement\_groups](#output\_placement\_groups) | List of placement groups. |
| [resource\_group\_data](#output\_resource\_group\_data) | List of resource groups data used within landing zone. |
| [resource\_group\_names](#output\_resource\_group\_names) | List of resource groups names used within landing zone. |
@@ -986,6 +987,7 @@ module "cluster_pattern" {
| [vsi\_data](#output\_vsi\_data) | A list of VSI with name, id, zone, and primary ipv4 address, VPC Name, and floating IP. |
| [vsi\_names](#output\_vsi\_names) | List of VSI names |
| [workload\_cluster\_id](#output\_workload\_cluster\_id) | The id of the workload cluster. If the cluster name does not exactly match the prefix-workload-cluster pattern it will be null. |
+| [workload\_cluster\_name](#output\_workload\_cluster\_name) | The name of the workload cluster. If the cluster name does not exactly match the prefix-workload-cluster pattern it will be null. |
diff --git a/outputs.tf b/outputs.tf
index c4031cb7..cc68b399 100644
--- a/outputs.tf
+++ b/outputs.tf
@@ -79,11 +79,21 @@ output "workload_cluster_id" {
value = lookup(ibm_container_vpc_cluster.cluster, "${var.prefix}-workload-cluster", null) != null ? ibm_container_vpc_cluster.cluster["${var.prefix}-workload-cluster"].id : null
}
+output "workload_cluster_name" {
+ description = "The name of the workload cluster. If the cluster name does not exactly match the prefix-workload-cluster pattern it will be null."
+ value = lookup(ibm_container_vpc_cluster.cluster, "${var.prefix}-workload-cluster", null) != null ? ibm_container_vpc_cluster.cluster["${var.prefix}-workload-cluster"].name : null
+}
+
output "management_cluster_id" {
description = "The id of the management cluster. If the cluster name does not exactly match the prefix-management-cluster pattern it will be null."
value = lookup(ibm_container_vpc_cluster.cluster, "${var.prefix}-management-cluster", null) != null ? ibm_container_vpc_cluster.cluster["${var.prefix}-management-cluster"].id : null
}
+output "management_cluster_name" {
+ description = "The name of the management cluster. If the cluster name does not exactly match the prefix-management-cluster pattern it will be null."
+ value = lookup(ibm_container_vpc_cluster.cluster, "${var.prefix}-management-cluster", null) != null ? ibm_container_vpc_cluster.cluster["${var.prefix}-management-cluster"].name : null
+}
+
output "cluster_data" {
description = "List of cluster data"
value = {
diff --git a/patterns/roks/module/outputs.tf b/patterns/roks/module/outputs.tf
index c83f5fa2..58bc5a4f 100644
--- a/patterns/roks/module/outputs.tf
+++ b/patterns/roks/module/outputs.tf
@@ -87,11 +87,21 @@ output "workload_cluster_id" {
value = module.landing_zone.workload_cluster_id
}
+output "workload_cluster_name" {
+ description = "The name of the worload cluster. If the cluster name does not exactly match the prefix-workload-cluster pattern it will be null."
+ value = module.landing_zone.workload_cluster_name
+}
+
output "management_cluster_id" {
description = "The id of the management cluster. If the cluster name does not exactly match the prefix-management-cluster pattern it will be null."
value = module.landing_zone.management_cluster_id
}
+output "management_cluster_name" {
+ description = "The name of the management cluster. If the cluster name does not exactly match the prefix-management-cluster pattern it will be null."
+ value = module.landing_zone.management_cluster_name
+}
+
output "workload_cluster_ingress_hostname" {
description = "The hostname assigned for the Workload cluster ingress subdomain, if not then null."
value = one(
diff --git a/patterns/roks/outputs.tf b/patterns/roks/outputs.tf
index be11a242..fa514ec0 100644
--- a/patterns/roks/outputs.tf
+++ b/patterns/roks/outputs.tf
@@ -87,11 +87,21 @@ output "workload_cluster_id" {
value = module.roks_landing_zone.workload_cluster_id
}
+output "workload_cluster_name" {
+ description = "The name of the workload cluster. If the cluster name does not exactly match the prefix-workload-cluster pattern it will be null."
+ value = module.roks_landing_zone.workload_cluster_name
+}
+
output "management_cluster_id" {
description = "The id of the management cluster. If the cluster name does not exactly match the prefix-management-cluster pattern it will be null."
value = module.roks_landing_zone.management_cluster_id
}
+output "management_cluster_name" {
+ description = "The name of the management cluster. If the cluster name does not exactly match the prefix-management-cluster pattern it will be null."
+ value = module.roks_landing_zone.management_cluster_name
+}
+
output "workload_cluster_ingress_hostname" {
description = "The hostname assigned for the Workload cluster ingress subdomain, if not then null."
value = module.roks_landing_zone.workload_cluster_ingress_hostname