From e09f566373ad7b554a42c82653b890da0c8d37a2 Mon Sep 17 00:00:00 2001 From: amanpruthi Date: Thu, 18 Jul 2024 21:00:42 +0530 Subject: [PATCH] removed database region --- main.tf | 8 ++------ modules/database/main.tf | 1 - modules/database/variables.tf | 3 --- modules/redis/main.tf | 1 - modules/redis/variables.tf | 5 ----- variables.tf | 4 ---- 6 files changed, 2 insertions(+), 20 deletions(-) diff --git a/main.tf b/main.tf index 37f6d53d..79b4dc5c 100644 --- a/main.tf +++ b/main.tf @@ -28,7 +28,6 @@ locals { create_bucket = var.bucket_name == "" create_network = var.network == null bucket_location = var.bucket_location == "" ? "US" : var.bucket_location - database_region = var.database_region == "" ? var.region : var.database_region } module "service_accounts" { @@ -64,7 +63,7 @@ module "kms_default_sql" { source = "./modules/kms" namespace = var.namespace deletion_protection = var.deletion_protection - key_location = local.database_region + key_location = data.google_client_config.current.region bind_pubsub_service_to_kms_key = false } @@ -138,8 +137,7 @@ module "database" { deletion_protection = var.deletion_protection labels = var.labels crypto_key = var.sql_default_encryption || var.db_kms_key_id != "" ? local.sql_crypto_key : null - region = local.database_region - depends_on = [module.project_factory_project_services, module.kms_default_sql.google_kms_crypto_key_iam_binding] + depends_on = [module.project_factory_project_services, module.kms_default_sql.google_kms_crypto_key_iam_binding] } module "redis" { @@ -154,8 +152,6 @@ module "redis" { depends_on = [module.project_factory_project_services] tier = coalesce(try(local.deployment_size[var.size].cache, null), var.redis_tier) crypto_key = var.sql_default_encryption || var.db_kms_key_id != "" ? local.sql_crypto_key : null - region = local.database_region - } locals { diff --git a/modules/database/main.tf b/modules/database/main.tf index e9b78f18..41ec38c9 100644 --- a/modules/database/main.tf +++ b/modules/database/main.tf @@ -32,7 +32,6 @@ resource "google_sql_database_instance" "default" { name = local.master_instance_name database_version = var.database_version deletion_protection = var.deletion_protection - region = var.region encryption_key_name = var.crypto_key diff --git a/modules/database/variables.tf b/modules/database/variables.tf index da0551d6..c5acc1c4 100644 --- a/modules/database/variables.tf +++ b/modules/database/variables.tf @@ -30,9 +30,6 @@ variable "availability_type" { default = "REGIONAL" } -variable "region" { - type = string -} variable "maintenance_window_day" { description = "The day of week (1-7) for the master instance maintenance." diff --git a/modules/redis/main.tf b/modules/redis/main.tf index c9de5872..c3740901 100644 --- a/modules/redis/main.tf +++ b/modules/redis/main.tf @@ -6,7 +6,6 @@ resource "google_redis_instance" "default" { display_name = "${var.namespace} W&B Instance" tier = var.tier memory_size_gb = var.memory_size_gb - region = var.region customer_managed_key = var.crypto_key location_id = data.google_compute_zones.available.names.0 diff --git a/modules/redis/variables.tf b/modules/redis/variables.tf index 94149995..53928e0e 100644 --- a/modules/redis/variables.tf +++ b/modules/redis/variables.tf @@ -33,9 +33,4 @@ variable "crypto_key" { type = string default = null description = "Key used to encrypt and decrypt redis." -} - -variable "region" { - type = string - description = "Specifies the region for this Redis instance" } \ No newline at end of file diff --git a/variables.tf b/variables.tf index 4115676d..a36adc1b 100644 --- a/variables.tf +++ b/variables.tf @@ -348,8 +348,4 @@ variable "enable_stackdriver" { variable "stackdriver_sa_name" { type = string default = "wandb-stackdriver" -} - -variable "region" { - type = string } \ No newline at end of file