Skip to content

Commit

Permalink
removed database region
Browse files Browse the repository at this point in the history
  • Loading branch information
amanpruthi committed Jul 18, 2024
1 parent edc846a commit e09f566
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 20 deletions.
8 changes: 2 additions & 6 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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" {
Expand Down Expand Up @@ -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
}

Expand Down Expand Up @@ -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" {
Expand All @@ -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 {
Expand Down
1 change: 0 additions & 1 deletion modules/database/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 0 additions & 3 deletions modules/database/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down
1 change: 0 additions & 1 deletion modules/redis/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 0 additions & 5 deletions modules/redis/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
4 changes: 0 additions & 4 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -348,8 +348,4 @@ variable "enable_stackdriver" {
variable "stackdriver_sa_name" {
type = string
default = "wandb-stackdriver"
}

variable "region" {
type = string
}

0 comments on commit e09f566

Please sign in to comment.