From 66c6b3b3851fbc0df9bd115993a70649fe20b793 Mon Sep 17 00:00:00 2001 From: rochana Date: Tue, 27 Sep 2022 11:36:14 +0530 Subject: [PATCH] seperate jx installation from cluster creation --- main.tf | 180 +++------------------- modules/cluster/main.tf | 154 ++++++++---------- modules/cluster/outputs.tf | 26 +--- modules/cluster/variables.tf | 89 ----------- modules/jx/main.tf | 81 ++++++++++ modules/jx/outputs.tf | 24 +++ modules/{cluster => jx}/serviceaccount.tf | 9 -- modules/{cluster => jx}/storage.tf | 0 modules/jx/variables.tf | 98 ++++++++++++ output.tf | 25 +-- variables.tf | 10 +- 11 files changed, 300 insertions(+), 396 deletions(-) create mode 100644 modules/jx/main.tf create mode 100644 modules/jx/outputs.tf rename modules/{cluster => jx}/serviceaccount.tf (97%) rename modules/{cluster => jx}/storage.tf (100%) create mode 100644 modules/jx/variables.tf diff --git a/main.tf b/main.tf index 34df8ba3..8384ac7a 100644 --- a/main.tf +++ b/main.tf @@ -3,163 +3,25 @@ // // Using pessimistic version locking for all versions // ---------------------------------------------------------------------------- -terraform { - required_version = ">= 0.12.0, < 2.0" - required_providers { - google = ">= 4.26.0" - google-beta = ">= 4.26.0" - kubernetes = ">=2.11.0" - helm = ">=2.6.0" - random = ">= 3.3.2" - local = ">= 2.2.3" - null = ">= 2.1.0" - } -} - -// ---------------------------------------------------------------------------- -// Configure providers -// ---------------------------------------------------------------------------- -provider "google" { - project = var.gcp_project -} - -provider "google-beta" { - project = var.gcp_project -} - -data "google_client_config" "default" { -} -provider "kubernetes" { - host = "https://${module.cluster.cluster_endpoint}" - token = data.google_client_config.default.access_token - cluster_ca_certificate = base64decode(module.cluster.cluster_ca_certificate) -} -provider "helm" { - debug = true - kubernetes { - host = "https://${module.cluster.cluster_endpoint}" - token = data.google_client_config.default.access_token - client_certificate = base64decode(module.cluster.cluster_client_certificate) - client_key = base64decode(module.cluster.client_client_key) - cluster_ca_certificate = base64decode(module.cluster.cluster_ca_certificate) - } -} -resource "random_id" "random" { - byte_length = 6 -} - -resource "random_pet" "current" { - prefix = "tf-jx" - separator = "-" - keepers = { - # Keep the name consistent on executions - cluster_name = var.cluster_name - } -} - -locals { - cluster_name = var.cluster_name != "" ? var.cluster_name : random_pet.current.id - # provide backwards compatibility with the deprecated zone variable - location = var.zone != "" ? var.zone : var.cluster_location +locals{ external_vault = var.vault_url != "" ? true : false -} - -// ---------------------------------------------------------------------------- -// Enable all required GCloud APIs -// -// https://www.terraform.io/docs/providers/google/r/google_project_service.html -// ---------------------------------------------------------------------------- -resource "google_project_service" "cloudresourcemanager_api" { - provider = google - project = var.gcp_project - service = "cloudresourcemanager.googleapis.com" - disable_on_destroy = false -} - -resource "google_project_service" "compute_api" { - provider = google - project = var.gcp_project - service = "compute.googleapis.com" - disable_on_destroy = false -} - -resource "google_project_service" "iam_api" { - provider = google - project = var.gcp_project - service = "iam.googleapis.com" - disable_on_destroy = false -} - -resource "google_project_service" "cloudbuild_api" { - provider = google - project = var.gcp_project - service = "cloudbuild.googleapis.com" - disable_on_destroy = false -} - -resource "google_project_service" "containerregistry_api" { - provider = google - project = var.gcp_project - service = "containerregistry.googleapis.com" - disable_on_destroy = false -} - -resource "google_project_service" "containeranalysis_api" { - provider = google - project = var.gcp_project - service = "containeranalysis.googleapis.com" - disable_on_destroy = false -} -resource "google_project_service" "serviceusage_api" { - provider = google - project = var.gcp_project - service = "serviceusage.googleapis.com" - disable_on_destroy = false } -resource "google_project_service" "container_api" { - provider = google - project = var.gcp_project - service = "container.googleapis.com" - disable_on_destroy = false -} - -// ---------------------------------------------------------------------------- -// Create Kubernetes cluster -// ---------------------------------------------------------------------------- -module "cluster" { - source = "./modules/cluster" +module "jx" { + source = "./modules/jx" gcp_project = var.gcp_project - cluster_name = local.cluster_name - cluster_location = local.location - cluster_network = var.cluster_network - cluster_subnetwork = var.cluster_subnetwork - cluster_id = random_id.random.hex - enable_private_nodes = var.enable_private_nodes - master_ipv4_cidr_block = var.master_ipv4_cidr_block - master_authorized_networks = var.master_authorized_networks - ip_range_pods = var.ip_range_pods - ip_range_services = var.ip_range_services - max_pods_per_node = var.max_pods_per_node + cluster_name = var.cluster_name + cluster_id = var.cluster_id bucket_location = var.bucket_location jenkins_x_namespace = var.jenkins_x_namespace force_destroy = var.force_destroy - node_machine_type = var.node_machine_type - node_disk_size = var.node_disk_size - node_disk_type = var.node_disk_type - node_preemptible = var.node_preemptible - node_spot = var.node_spot - min_node_count = var.min_node_count - max_node_count = var.max_node_count - release_channel = var.release_channel - resource_labels = var.resource_labels create_ui_sa = var.create_ui_sa jx2 = var.jx2 @@ -182,10 +44,10 @@ module "vault" { source = "./modules/vault" gcp_project = var.gcp_project - cluster_name = local.cluster_name - cluster_id = random_id.random.hex + cluster_name = var.cluster_name + cluster_id = var.cluster_id bucket_location = var.bucket_location - jenkins_x_namespace = module.cluster.jenkins_x_namespace + jenkins_x_namespace = module.jx.jenkins_x_namespace force_destroy = var.force_destroy external_vault = local.external_vault jx2 = var.jx2 @@ -200,8 +62,8 @@ module "gsm" { source = "./modules/gsm" gcp_project = var.gcp_project - cluster_name = local.cluster_name - cluster_id = random_id.random.hex + cluster_name = var.cluster_name + cluster_id = var.cluster_id } // ---------------------------------------------------------------------------- @@ -212,10 +74,10 @@ module "backup" { enable_backup = var.enable_backup gcp_project = var.gcp_project - cluster_name = local.cluster_name - cluster_id = random_id.random.hex + cluster_name = var.cluster_name + cluster_id = var.cluster_id bucket_location = var.bucket_location - jenkins_x_namespace = module.cluster.jenkins_x_namespace + jenkins_x_namespace = module.jx.jenkins_x_namespace force_destroy = var.force_destroy jx2 = var.jx2 } @@ -228,16 +90,16 @@ module "dns" { source = "./modules/dns" gcp_project = var.gcp_project - cluster_name = local.cluster_name + cluster_name = var.cluster_name apex_domain = var.apex_domain != "" ? var.apex_domain : var.parent_domain - jenkins_x_namespace = module.cluster.jenkins_x_namespace + jenkins_x_namespace = module.jx.jenkins_x_namespace jx2 = var.jx2 subdomain = var.subdomain apex_domain_gcp_project = var.apex_domain_gcp_project != "" ? var.apex_domain_gcp_project : (var.parent_domain_gcp_project != "" ? var.parent_domain_gcp_project : var.gcp_project) apex_domain_integration_enabled = var.apex_domain_integration_enabled depends_on = [ - module.cluster + module.jx ] } @@ -248,7 +110,7 @@ module "dns" { module "jx-boot" { source = "./modules/jx-boot" - depends_on = [module.cluster] + depends_on = [module.jx] install_vault = !var.gsm ? true : false } @@ -260,14 +122,14 @@ locals { interpolated_content = templatefile(local.requirements_file, { gcp_project = var.gcp_project zone = var.cluster_location - cluster_name = local.cluster_name + cluster_name = var.cluster_name git_owner_requirement_repos = var.git_owner_requirement_repos dev_env_approvers = var.dev_env_approvers lets_encrypt_production = var.lets_encrypt_production // Storage buckets - log_storage_url = module.cluster.log_storage_url - report_storage_url = module.cluster.report_storage_url - repository_storage_url = module.cluster.repository_storage_url + log_storage_url = module.jx.log_storage_url + report_storage_url = module.jx.report_storage_url + repository_storage_url = module.jx.repository_storage_url backup_bucket_url = module.backup.backup_bucket_url // Vault external_vault = local.external_vault diff --git a/modules/cluster/main.tf b/modules/cluster/main.tf index 1db743a4..846bfadd 100644 --- a/modules/cluster/main.tf +++ b/modules/cluster/main.tf @@ -21,6 +21,67 @@ locals { max_pods_per_node = local.enable_vpc_native ? var.max_pods_per_node : null } +// ---------------------------------------------------------------------------- +// Enable all required GCloud APIs +// +// https://www.terraform.io/docs/providers/google/r/google_project_service.html +// ---------------------------------------------------------------------------- +resource "google_project_service" "cloudresourcemanager_api" { + provider = google + project = var.gcp_project + service = "cloudresourcemanager.googleapis.com" + disable_on_destroy = false +} + +resource "google_project_service" "compute_api" { + provider = google + project = var.gcp_project + service = "compute.googleapis.com" + disable_on_destroy = false +} + +resource "google_project_service" "iam_api" { + provider = google + project = var.gcp_project + service = "iam.googleapis.com" + disable_on_destroy = false +} + +resource "google_project_service" "cloudbuild_api" { + provider = google + project = var.gcp_project + service = "cloudbuild.googleapis.com" + disable_on_destroy = false +} + +resource "google_project_service" "containerregistry_api" { + provider = google + project = var.gcp_project + service = "containerregistry.googleapis.com" + disable_on_destroy = false +} + +resource "google_project_service" "containeranalysis_api" { + provider = google + project = var.gcp_project + service = "containeranalysis.googleapis.com" + disable_on_destroy = false +} + +resource "google_project_service" "serviceusage_api" { + provider = google + project = var.gcp_project + service = "serviceusage.googleapis.com" + disable_on_destroy = false +} + +resource "google_project_service" "container_api" { + provider = google + project = var.gcp_project + service = "container.googleapis.com" + disable_on_destroy = false +} + resource "google_container_cluster" "jx_cluster" { name = var.cluster_name description = "jenkins-x cluster" @@ -126,96 +187,3 @@ resource "google_container_node_pool" "primary" { } } -module "jx-health" { - count = !var.jx2 && var.kuberhealthy ? 1 : 0 - source = "github.com/jenkins-x/terraform-jx-health?ref=main" - - depends_on = [ - google_container_node_pool.primary - ] -} - -// ---------------------------------------------------------------------------- -// Add main Jenkins X Kubernetes namespace -// -// https://www.terraform.io/docs/providers/kubernetes/r/namespace.html -// ---------------------------------------------------------------------------- -resource "kubernetes_namespace" "jenkins_x_namespace" { - count = var.jx2 ? 1 : 0 - metadata { - name = var.jenkins_x_namespace - } - lifecycle { - ignore_changes = [ - metadata[0].labels, - metadata[0].annotations, - ] - } - depends_on = [ - google_container_node_pool.primary - ] -} - -// ---------------------------------------------------------------------------- -// Add the Terraform generated jx-requirements.yml to a configmap so it can be -// sync'd with the Git repository -// -// https://www.terraform.io/docs/providers/kubernetes/r/namespace.html -// ---------------------------------------------------------------------------- -resource "kubernetes_config_map" "jenkins_x_requirements" { - count = var.jx2 ? 0 : 1 - metadata { - name = "terraform-jx-requirements" - namespace = "default" - } - data = { - "jx-requirements.yml" = var.content - } - depends_on = [ - google_container_node_pool.primary - ] -} - -resource "helm_release" "jx-git-operator" { - count = var.jx2 || var.jx_git_url == "" ? 0 : 1 - - provider = helm - name = "jx-git-operator" - chart = "jx-git-operator" - namespace = "jx-git-operator" - repository = "https://jenkins-x-charts.github.io/repo" - version = var.jx_git_operator_version - create_namespace = true - - set { - name = "bootServiceAccount.enabled" - value = true - } - set { - name = "bootServiceAccount.annotations.iam\\.gke\\.io/gcp-service-account" - value = "${var.cluster_name}-boot@${var.gcp_project}.iam.gserviceaccount.com" - } - set { - name = "env.NO_RESOURCE_APPLY" - value = true - } - set { - name = "url" - value = var.jx_git_url - } - set { - name = "username" - value = var.jx_bot_username - } - set { - name = "password" - value = var.jx_bot_token - } - - lifecycle { - ignore_changes = all - } - depends_on = [ - google_container_node_pool.primary - ] -} diff --git a/modules/cluster/outputs.tf b/modules/cluster/outputs.tf index 50e5eac4..0c6e1760 100644 --- a/modules/cluster/outputs.tf +++ b/modules/cluster/outputs.tf @@ -21,27 +21,7 @@ output "client_client_key" { output "cluster_ca_certificate" { value = length(google_container_cluster.jx_cluster.master_auth) > 0 ? google_container_cluster.jx_cluster.master_auth[0].cluster_ca_certificate : "" } - -output "log_storage_url" { - value = length(google_storage_bucket.log_bucket) > 0 ? google_storage_bucket.log_bucket[0].url : "" -} - -output "report_storage_url" { - value = length(google_storage_bucket.report_bucket) > 0 ? google_storage_bucket.report_bucket[0].url : "" -} - -output "repository_storage_url" { - value = length(google_storage_bucket.repository_bucket) > 0 ? google_storage_bucket.repository_bucket[0].url : "" -} - -output "jenkins_x_namespace" { - value = var.jenkins_x_namespace -} - -output "tekton_sa_email" { - value = google_service_account.tekton_sa.email -} - -output "tekton_sa_name" { - value = google_service_account.tekton_sa.name +output "connect" { + description = "The cluster connection string to use once Terraform apply finishes" + value = "gcloud container clusters get-credentials ${var.cluster_name} --zone ${var.cluster_location} --project ${var.gcp_project}" } diff --git a/modules/cluster/variables.tf b/modules/cluster/variables.tf index 85510ee7..f0aaf719 100644 --- a/modules/cluster/variables.tf +++ b/modules/cluster/variables.tf @@ -28,49 +28,9 @@ variable "cluster_name" { type = string } -variable "jenkins_x_namespace" { - description = "Kubernetes namespace to install Jenkins X in" - type = string -} - -variable "cluster_id" { - description = "A random generated to uniqly name cluster resources" - type = string -} - -// ---------------------------------------------------------------------------- -// Optional Variables -// ---------------------------------------------------------------------------- -// storage -variable "bucket_location" { - description = "Bucket location for storage" - type = string - default = "US" -} - -variable "enable_log_storage" { - description = "Flag to enable or disable storage of build logs in a cloud bucket" - type = bool - default = true -} -variable "enable_report_storage" { - description = "Flag to enable or disable storage of build reports in a cloud bucket" - type = bool - default = true -} -variable "enable_repository_storage" { - description = "Flag to enable or disable storage of artifacts in a cloud bucket" - type = bool - default = true -} -variable "force_destroy" { - description = "Flag to determine whether storage buckets get forcefully destroyed" - type = bool - default = false -} // cluster configuration variable "enable_private_endpoint" { @@ -439,52 +399,3 @@ variable "logging_service" { type = string default = "logging.googleapis.com/kubernetes" } - -// service accounts -variable "create_ui_sa" { - description = "Whether the cloud service account for the UI should be created" - type = bool - default = true -} - -variable "jx2" { - description = "Is a Jenkins X 2 install" - type = bool - default = true -} - -variable "jx_git_url" { - description = "URL for the Jenins X cluster git repository" - type = string - default = "" -} - -variable "jx_bot_username" { - description = "Bot username used to interact with the Jenkins X cluster git repository" - type = string - default = "" -} - -variable "jx_bot_token" { - description = "Bot token used to interact with the Jenkins X cluster git repository" - type = string - default = "" -} - -variable "jx_git_operator_version" { - description = "The jx-git-operator helm chart version" - type = string - default = "0.0.192" -} - -variable "kuberhealthy" { - description = "Enable Kuberhealthy helm installation" - type = bool - default = true -} - -variable "content" { - description = "Interpolated jx-requirements.yml" - type = string - default = "" -} diff --git a/modules/jx/main.tf b/modules/jx/main.tf new file mode 100644 index 00000000..2b506d6c --- /dev/null +++ b/modules/jx/main.tf @@ -0,0 +1,81 @@ + +module "jx-health" { + count = !var.jx2 && var.kuberhealthy ? 1 : 0 + source = "github.com/jenkins-x/terraform-jx-health?ref=main" +} + +// ---------------------------------------------------------------------------- +// Add main Jenkins X Kubernetes namespace +// +// https://www.terraform.io/docs/providers/kubernetes/r/namespace.html +// ---------------------------------------------------------------------------- +resource "kubernetes_namespace" "jenkins_x_namespace" { + count = var.jx2 ? 1 : 0 + metadata { + name = var.jenkins_x_namespace + } + lifecycle { + ignore_changes = [ + metadata[0].labels, + metadata[0].annotations, + ] + } +} + +// ---------------------------------------------------------------------------- +// Add the Terraform generated jx-requirements.yml to a configmap so it can be +// sync'd with the Git repository +// +// https://www.terraform.io/docs/providers/kubernetes/r/namespace.html +// ---------------------------------------------------------------------------- +resource "kubernetes_config_map" "jenkins_x_requirements" { + count = var.jx2 ? 0 : 1 + metadata { + name = "terraform-jx-requirements" + namespace = "default" + } + data = { + "jx-requirements.yml" = var.content + } +} + +resource "helm_release" "jx-git-operator" { + count = var.jx2 || var.jx_git_url == "" ? 0 : 1 + + provider = helm + name = "jx-git-operator" + chart = "jx-git-operator" + namespace = "jx-git-operator" + repository = "https://jenkins-x-charts.github.io/repo" + version = var.jx_git_operator_version + create_namespace = true + + set { + name = "bootServiceAccount.enabled" + value = true + } + set { + name = "bootServiceAccount.annotations.iam\\.gke\\.io/gcp-service-account" + value = "${var.cluster_name}-boot@${var.gcp_project}.iam.gserviceaccount.com" + } + set { + name = "env.NO_RESOURCE_APPLY" + value = true + } + set { + name = "url" + value = var.jx_git_url + } + set { + name = "username" + value = var.jx_bot_username + } + set { + name = "password" + value = var.jx_bot_token + } + + lifecycle { + ignore_changes = all + } +} diff --git a/modules/jx/outputs.tf b/modules/jx/outputs.tf new file mode 100644 index 00000000..976e3792 --- /dev/null +++ b/modules/jx/outputs.tf @@ -0,0 +1,24 @@ + +output "log_storage_url" { + value = length(google_storage_bucket.log_bucket) > 0 ? google_storage_bucket.log_bucket[0].url : "" +} + +output "report_storage_url" { + value = length(google_storage_bucket.report_bucket) > 0 ? google_storage_bucket.report_bucket[0].url : "" +} + +output "repository_storage_url" { + value = length(google_storage_bucket.repository_bucket) > 0 ? google_storage_bucket.repository_bucket[0].url : "" +} + +output "jenkins_x_namespace" { + value = var.jenkins_x_namespace +} + +output "tekton_sa_email" { + value = google_service_account.tekton_sa.email +} + +output "tekton_sa_name" { + value = google_service_account.tekton_sa.name +} diff --git a/modules/cluster/serviceaccount.tf b/modules/jx/serviceaccount.tf similarity index 97% rename from modules/cluster/serviceaccount.tf rename to modules/jx/serviceaccount.tf index 94febab3..c8ee1356 100644 --- a/modules/cluster/serviceaccount.tf +++ b/modules/jx/serviceaccount.tf @@ -133,9 +133,6 @@ resource "kubernetes_service_account" "build_controller_sa" { secret ] } - depends_on = [ - google_container_cluster.jx_cluster, - ] } // ---------------------------------------------------------------------------- @@ -157,9 +154,6 @@ resource "kubernetes_service_account" "kaniko_sa" { secret ] } - depends_on = [ - google_container_cluster.jx_cluster, - ] } resource "google_service_account_iam_member" "kaniko_sa_workload_identity_user" { @@ -195,9 +189,6 @@ resource "kubernetes_service_account" "tekton_sa" { secret ] } - depends_on = [ - google_container_cluster.jx_cluster, - ] } // ---------------------------------------------------------------------------- diff --git a/modules/cluster/storage.tf b/modules/jx/storage.tf similarity index 100% rename from modules/cluster/storage.tf rename to modules/jx/storage.tf diff --git a/modules/jx/variables.tf b/modules/jx/variables.tf new file mode 100644 index 00000000..ed9fb4a1 --- /dev/null +++ b/modules/jx/variables.tf @@ -0,0 +1,98 @@ + +variable "gcp_project" { + description = "The name of the GCP project" + type = string +} +variable "cluster_id" { + description = "A random generated to uniqly name cluster resources" + type = string +} +variable "cluster_name" { + description = "Name of the Kubernetes cluster" + type = string +} +variable "jenkins_x_namespace" { + description = "Kubernetes namespace to install Jenkins X in" + type = string +} +// ---------------------------------------------------------------------------- +// Optional Variables +// ---------------------------------------------------------------------------- +// storage +variable "bucket_location" { + description = "Bucket location for storage" + type = string + default = "US" +} + +variable "enable_log_storage" { + description = "Flag to enable or disable storage of build logs in a cloud bucket" + type = bool + default = true +} + +variable "enable_report_storage" { + description = "Flag to enable or disable storage of build reports in a cloud bucket" + type = bool + default = true +} + +variable "enable_repository_storage" { + description = "Flag to enable or disable storage of artifacts in a cloud bucket" + type = bool + default = true +} +variable "force_destroy" { + description = "Flag to determine whether storage buckets get forcefully destroyed" + type = bool + default = false +} + +// service accounts +variable "create_ui_sa" { + description = "Whether the cloud service account for the UI should be created" + type = bool + default = true +} + +variable "jx2" { + description = "Is a Jenkins X 2 install" + type = bool + default = true +} + +variable "jx_git_url" { + description = "URL for the Jenins X cluster git repository" + type = string + default = "" +} + +variable "jx_bot_username" { + description = "Bot username used to interact with the Jenkins X cluster git repository" + type = string + default = "" +} + +variable "jx_bot_token" { + description = "Bot token used to interact with the Jenkins X cluster git repository" + type = string + default = "" +} + +variable "jx_git_operator_version" { + description = "The jx-git-operator helm chart version" + type = string + default = "0.0.192" +} + +variable "kuberhealthy" { + description = "Enable Kuberhealthy helm installation" + type = bool + default = true +} + +variable "content" { + description = "Interpolated jx-requirements.yml" + type = string + default = "" +} diff --git a/output.tf b/output.tf index 602e387d..9c3c5f17 100644 --- a/output.tf +++ b/output.tf @@ -3,29 +3,21 @@ output "gcp_project" { value = var.gcp_project } -output "cluster_location" { - description = "The location of the created Kubernetes cluster" - value = var.cluster_location -} -output "cluster_name" { - description = "The name of the created Kubernetes cluster" - value = local.cluster_name -} output "log_storage_url" { description = "The URL to the bucket for log storage" - value = module.cluster.log_storage_url + value = module.jx.log_storage_url } output "report_storage_url" { description = "The URL to the bucket for report storage" - value = module.cluster.report_storage_url + value = module.jx.report_storage_url } output "repository_storage_url" { description = "The URL to the bucket for artifact storage" - value = module.cluster.repository_storage_url + value = module.jx.repository_storage_url } output "vault_bucket_url" { @@ -40,12 +32,12 @@ output "backup_bucket_url" { output "tekton_sa_email" { description = "The Tekton service account email address, useful to provide further IAM bindings" - value = module.cluster.tekton_sa_email + value = module.jx.tekton_sa_email } output "tekton_sa_name" { description = "The Tekton service account name, useful to provide further IAM bindings" - value = module.cluster.tekton_sa_name + value = module.jx.tekton_sa_name } @@ -54,10 +46,7 @@ output "jx_requirements" { value = local.content } -output "connect" { - description = "The cluster connection string to use once Terraform apply finishes" - value = "gcloud container clusters get-credentials ${local.cluster_name} --zone ${var.cluster_location} --project ${var.gcp_project}" -} + output "externaldns_ns" { description = "ExternalDNS nameservers" @@ -67,4 +56,4 @@ output "externaldns_ns" { output "externaldns_dns_name" { description = "ExternalDNS name" value = module.dns.externaldns_dns_name -} \ No newline at end of file +} diff --git a/variables.tf b/variables.tf index 653bf8df..9938f2fe 100644 --- a/variables.tf +++ b/variables.tf @@ -5,6 +5,10 @@ variable "gcp_project" { description = "The name of the GCP project to use" type = string } +variable "cluster_id" { + description = "A random generated to uniqly name cluster resources" + type = string +} // ---------------------------------------------------------------------------- // Optional Variables @@ -15,11 +19,7 @@ variable "cluster_name" { default = "" } -variable "zone" { - description = "Zone in which to create the cluster (deprecated, use cluster_location instead)" - type = string - default = "" -} + variable "cluster_location" { description = "The location (region or zone) in which the cluster master will be created. If you specify a zone (such as us-central1-a), the cluster will be a zonal cluster with a single cluster master. If you specify a region (such as us-west1), the cluster will be a regional cluster with multiple masters spread across zones in the region"