diff --git a/modules/fleet-membership/README.md b/modules/fleet-membership/README.md index dd7e45cc1f..b0c4419136 100644 --- a/modules/fleet-membership/README.md +++ b/modules/fleet-membership/README.md @@ -29,6 +29,7 @@ To deploy this config: | enable\_fleet\_registration | Enables GKE Hub Registration when set to true | `bool` | `true` | no | | hub\_project\_id | The project in which the GKE Hub belongs. Defaults to GKE cluster project\_id. | `string` | `""` | no | | location | The location (zone or region) this cluster has been created in. | `string` | n/a | yes | +| membership\_location | Membership location for the cluster. Defaults to global. | `string` | `"global"` | no | | membership\_name | Membership name that uniquely represents the cluster being registered. Defaults to `$project_id-$location-$cluster_name`. | `string` | `""` | no | | project\_id | The project in which the GKE cluster belongs. | `string` | n/a | yes | diff --git a/modules/fleet-membership/membership.tf b/modules/fleet-membership/membership.tf index c5ef4cce39..796e3eb31f 100644 --- a/modules/fleet-membership/membership.tf +++ b/modules/fleet-membership/membership.tf @@ -1,5 +1,5 @@ /** - * Copyright 2018 Google LLC + * Copyright 2018-2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,6 +21,7 @@ resource "google_gke_hub_membership" "primary" { project = local.hub_project_id membership_id = local.gke_hub_membership_name + location = var.membership_location endpoint { gke_cluster { diff --git a/modules/fleet-membership/variables.tf b/modules/fleet-membership/variables.tf index eec5b4fd9b..df5c5462c9 100644 --- a/modules/fleet-membership/variables.tf +++ b/modules/fleet-membership/variables.tf @@ -1,5 +1,5 @@ /** - * Copyright 2018 Google LLC + * Copyright 2018-2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -46,3 +46,10 @@ variable "membership_name" { type = string default = "" } + +// Defaults to global for backward compatibility. +variable "membership_location" { + description = "Membership location for the cluster. Defaults to global." + type = string + default = "global" +}