Skip to content

Commit 163de39

Browse files
authored
feat: add optional membership_location to fleet-membership (#1860)
1 parent 5a407bc commit 163de39

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

modules/fleet-membership/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ To deploy this config:
2929
| enable\_fleet\_registration | Enables GKE Hub Registration when set to true | `bool` | `true` | no |
3030
| hub\_project\_id | The project in which the GKE Hub belongs. Defaults to GKE cluster project\_id. | `string` | `""` | no |
3131
| location | The location (zone or region) this cluster has been created in. | `string` | n/a | yes |
32+
| membership\_location | Membership location for the cluster. Defaults to global. | `string` | `"global"` | no |
3233
| membership\_name | Membership name that uniquely represents the cluster being registered. Defaults to `$project_id-$location-$cluster_name`. | `string` | `""` | no |
3334
| project\_id | The project in which the GKE cluster belongs. | `string` | n/a | yes |
3435

modules/fleet-membership/membership.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright 2018 Google LLC
2+
* Copyright 2018-2024 Google LLC
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -21,6 +21,7 @@ resource "google_gke_hub_membership" "primary" {
2121

2222
project = local.hub_project_id
2323
membership_id = local.gke_hub_membership_name
24+
location = var.membership_location
2425

2526
endpoint {
2627
gke_cluster {

modules/fleet-membership/variables.tf

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright 2018 Google LLC
2+
* Copyright 2018-2024 Google LLC
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -46,3 +46,10 @@ variable "membership_name" {
4646
type = string
4747
default = ""
4848
}
49+
50+
// Defaults to global for backward compatibility.
51+
variable "membership_location" {
52+
description = "Membership location for the cluster. Defaults to global."
53+
type = string
54+
default = "global"
55+
}

0 commit comments

Comments
 (0)