From bbe0cfead819efa670f952f44247b2823543c2a4 Mon Sep 17 00:00:00 2001 From: Andrew Peabody Date: Fri, 16 Feb 2024 17:23:15 +0000 Subject: [PATCH] fix: null fleet location when no registration --- modules/fleet-membership/main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/fleet-membership/main.tf b/modules/fleet-membership/main.tf index 92d5d83f7f..e57418caf0 100644 --- a/modules/fleet-membership/main.tf +++ b/modules/fleet-membership/main.tf @@ -18,7 +18,7 @@ locals { hub_project_id = var.hub_project_id == "" ? var.project_id : var.hub_project_id gke_hub_membership_name_complete = var.membership_name != "" ? var.membership_name : "${var.project_id}-${var.location}-${var.cluster_name}" gke_hub_membership_name = trimsuffix(substr(local.gke_hub_membership_name_complete, 0, 63), "-") - gke_hub_membership_location = regex(local.gke_hub_membership_location_re, data.google_container_cluster.primary.fleet[0].membership)[0] + gke_hub_membership_location = try(regex(local.gke_hub_membership_location_re, data.google_container_cluster.primary.fleet[0].membership)[0], null) gke_hub_membership_location_re = "//gkehub.googleapis.com/projects/[^/]*/locations/([^/]*)/memberships/[^/]*$" }