From c3e6a03eaae743a49da36cefa82f3469ae26a6a3 Mon Sep 17 00:00:00 2001 From: Julio Castillo Date: Thu, 25 Aug 2022 14:24:39 +0200 Subject: [PATCH] Allow fleet project to be specified by the user --- examples/gke-serverless/multitenant-fleet/README.md | 5 +++-- examples/gke-serverless/multitenant-fleet/main.tf | 2 +- examples/gke-serverless/multitenant-fleet/variables.tf | 5 +++++ fast/stages/03-gke-multitenant/dev/main.tf | 1 + 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/examples/gke-serverless/multitenant-fleet/README.md b/examples/gke-serverless/multitenant-fleet/README.md index f0e0cd24..c1ae7476 100644 --- a/examples/gke-serverless/multitenant-fleet/README.md +++ b/examples/gke-serverless/multitenant-fleet/README.md @@ -141,7 +141,8 @@ fleet_features = { | [folder_id](variables.tf#L163) | Folder used for the GKE project in folders/nnnnnnnnnnn format. | string | ✓ | | | | [nodepools](variables.tf#L206) | | map(map(object({…}))) | ✓ | | | | [prefix](variables.tf#L223) | Prefix used for resources that need unique names. | string | ✓ | | | -| [vpc_config](variables.tf#L235) | Shared VPC project and VPC details. | object({…}) | ✓ | | | +| [project_id](variables.tf#L228) | ID of the project that will contain all the clusters. | string | ✓ | | | +| [vpc_config](variables.tf#L240) | Shared VPC project and VPC details. | object({…}) | ✓ | | | | [authenticator_security_group](variables.tf#L21) | Optional group used for Groups for GKE. | string | | null | | | [cluster_defaults](variables.tf#L32) | Default values for optional cluster configurations. | object({…}) | | {…} | | | [dns_domain](variables.tf#L94) | Domain name used for clusters, prefixed by each cluster name. Leave null to disable Cloud DNS for GKE. | string | | null | | @@ -153,7 +154,7 @@ fleet_features = { | [iam](variables.tf#L175) | Project-level authoritative IAM bindings for users and service accounts in {ROLE => [MEMBERS]} format. | map(list(string)) | | {} | | | [labels](variables.tf#L182) | Project-level labels. | map(string) | | {} | | | [nodepool_defaults](variables.tf#L188) | | object({…}) | | {…} | | -| [project_services](variables.tf#L228) | Additional project services to enable. | list(string) | | [] | | +| [project_services](variables.tf#L233) | Additional project services to enable. | list(string) | | [] | | ## Outputs diff --git a/examples/gke-serverless/multitenant-fleet/main.tf b/examples/gke-serverless/multitenant-fleet/main.tf index 411d51c5..64cc8640 100644 --- a/examples/gke-serverless/multitenant-fleet/main.tf +++ b/examples/gke-serverless/multitenant-fleet/main.tf @@ -17,7 +17,7 @@ module "gke-project-0" { source = "../../../modules/project" billing_account = var.billing_account_id - name = "gke-clusters-0" + name = var.project_id parent = var.folder_id prefix = var.prefix group_iam = var.group_iam diff --git a/examples/gke-serverless/multitenant-fleet/variables.tf b/examples/gke-serverless/multitenant-fleet/variables.tf index 5c609918..2354b136 100644 --- a/examples/gke-serverless/multitenant-fleet/variables.tf +++ b/examples/gke-serverless/multitenant-fleet/variables.tf @@ -225,6 +225,11 @@ variable "prefix" { type = string } +variable "project_id" { + description = "ID of the project that will contain all the clusters." + type = string +} + variable "project_services" { description = "Additional project services to enable." type = list(string) diff --git a/fast/stages/03-gke-multitenant/dev/main.tf b/fast/stages/03-gke-multitenant/dev/main.tf index 779f13d6..708461e2 100644 --- a/fast/stages/03-gke-multitenant/dev/main.tf +++ b/fast/stages/03-gke-multitenant/dev/main.tf @@ -20,6 +20,7 @@ module "gke-multitenant" { source = "../../../../examples/gke-serverless/multitenant-fleet" billing_account_id = var.billing_account.id folder_id = var.folder_ids.gke-dev + project_id = "gke-clusters-0" group_iam = var.group_iam iam = var.iam labels = merge(var.labels, { environment = "dev" })