Skip to content

Commit 674f772

Browse files
authored
feat: anthos modules remote fleet project (terraform-google-modules#1995)
1 parent 270a5c7 commit 674f772

File tree

4 files changed

+10
-2
lines changed

4 files changed

+10
-2
lines changed

modules/acm/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ data "google_client_config" "default" {}
8686
| enable\_mutation | Whether to enable mutations for ACM Policy Controller. | `bool` | `false` | no |
8787
| enable\_policy\_controller | Whether to enable the ACM Policy Controller on the cluster | `bool` | `true` | no |
8888
| enable\_referential\_rules | Enables referential constraints which reference another object in it definition and are therefore eventually consistent. | `bool` | `true` | no |
89+
| fleet\_project\_id | The project in which the GKE fleet is located. Defaults to GKE cluster project\_id. | `string` | `""` | no |
8990
| gcp\_service\_account\_email | The service account email for authentication when `secret_type` is `gcpServiceAccount`. | `string` | `null` | no |
9091
| hierarchy\_controller | Configurations for Hierarchy Controller. See [Hierarchy Controller docs](https://cloud.google.com/anthos-config-management/docs/how-to/installing-hierarchy-controller) for more details | `map(any)` | `null` | no |
9192
| https\_proxy | URL for the HTTPS proxy to be used when communicating with the Git repo. | `string` | `null` | no |

modules/acm/feature.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ resource "google_gke_hub_feature" "acm" {
1919
provider = google-beta
2020

2121
name = "configmanagement"
22-
project = var.project_id
22+
project = coalesce(var.fleet_project_id, var.project_id)
2323
location = "global"
2424
}
2525

@@ -33,7 +33,7 @@ resource "google_gke_hub_feature_membership" "main" {
3333
feature = "configmanagement"
3434

3535
membership = module.registration.cluster_membership_id
36-
project = var.project_id
36+
project = coalesce(var.fleet_project_id, var.project_id)
3737

3838
configmanagement {
3939
version = var.configmanagement_version

modules/acm/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ module "registration" {
2424

2525
cluster_name = var.cluster_name
2626
project_id = var.project_id
27+
hub_project_id = var.fleet_project_id
2728
location = var.location
2829
enable_fleet_registration = var.enable_fleet_registration
2930
membership_name = var.cluster_membership_id

modules/acm/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ variable "project_id" {
2424
type = string
2525
}
2626

27+
variable "fleet_project_id" {
28+
description = "The project in which the GKE fleet is located. Defaults to GKE cluster project_id."
29+
type = string
30+
default = ""
31+
}
32+
2733
variable "location" {
2834
description = "GCP location used to reach cluster."
2935
type = string

0 commit comments

Comments
 (0)