Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(TPG>=5.6)!: use hub membership location for output #1824

Merged
merged 4 commits into from
Dec 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion modules/fleet-membership/main.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2018 Google LLC
* Copyright 2018-2023 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -18,6 +18,8 @@ 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_re = "//gkehub.googleapis.com/projects/[^/]*/locations/([^/]*)/memberships/[^/]*$"
}

# Retrieve GKE cluster info
Expand Down
3 changes: 1 addition & 2 deletions modules/fleet-membership/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ output "project_id" {
}

output "location" {
# TODO: google_gke_hub_membership b/300473592
description = "The location of the hub membership."
value = "global"
value = var.enable_fleet_registration ? google_gke_hub_membership.primary[0].location : local.gke_hub_membership_location
}
10 changes: 4 additions & 6 deletions modules/fleet-membership/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,12 @@ terraform {

required_providers {
google = {
source = "hashicorp/google"
# Avoid v4.49 and v4.50 for https://github.com/hashicorp/terraform-provider-google/issues/13507
version = ">= 4.47.0, != 4.49.0, != 4.50.0, < 6"
source = "hashicorp/google"
version = ">= 5.6.0, < 6"
}
google-beta = {
source = "hashicorp/google-beta"
# Avoid v4.49 and v4.50 for https://github.com/hashicorp/terraform-provider-google/issues/13507
version = ">= 4.47.0, != 4.49.0, != 4.50.0, < 6"
source = "hashicorp/google-beta"
version = ">= 5.6.0, < 6"
}
}

Expand Down
Loading