Skip to content

Commit

Permalink
feat: add optional membership_location to fleet-membership
Browse files Browse the repository at this point in the history
  • Loading branch information
apeabody committed Jan 31, 2024
1 parent e58c094 commit 2e66b3b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions modules/fleet-membership/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 the cluster location. | `string` | `null` | 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 |

Expand Down
3 changes: 2 additions & 1 deletion modules/fleet-membership/membership.tf
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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 {
Expand Down
9 changes: 8 additions & 1 deletion modules/fleet-membership/variables.tf
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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"
}

0 comments on commit 2e66b3b

Please sign in to comment.