simplify service_encryption_keys logic

This commit is contained in:
Lorenzo Caggioni 2022-02-01 07:09:25 +01:00
parent 5021592ec3
commit 7bcaa86703
6 changed files with 14 additions and 14 deletions

View File

@ -43,7 +43,7 @@ module "lnd-cs-0" {
location = var.location_config.region
storage_class = "REGIONAL"
# retention_policy = local.lnd_bucket_retention_policy
encryption_key = try(local.service_encryption_keys.storage != null, false) ? try(local.service_encryption_keys.storage, null) : null
encryption_key = try(local.service_encryption_keys.storage, null)
force_destroy = var.data_force_destroy
}
@ -86,5 +86,5 @@ module "lnd-bq-0" {
project_id = module.lnd-prj.project_id
id = "${replace(local.prefix_lnd, "-", "_")}_bq_0"
location = var.location_config.region
encryption_key = try(local.service_encryption_keys.bq != null, false) ? try(local.service_encryption_keys.bq, null) : null
encryption_key = try(local.service_encryption_keys.bq, null)
}

View File

@ -38,5 +38,5 @@ module "lod-cs-df-0" {
prefix = local.prefix_lod
storage_class = "REGIONAL"
location = var.location_config.region
encryption_key = try(local.service_encryption_keys.storage != null, false) ? try(local.service_encryption_keys.storage, null) : null
encryption_key = try(local.service_encryption_keys.storage, null)
}

View File

@ -91,7 +91,7 @@ resource "google_composer_environment" "orc-cmp-0" {
dynamic "encryption_config" {
for_each = try(local.service_encryption_keys.composer != null, false) ? { 1 = 1 } : {}
content {
kms_key_name = try(local.service_encryption_keys.composer != null, false) ? try(local.service_encryption_keys.composer, null) : null
kms_key_name = try(local.service_encryption_keys.composer, null)
}
}

View File

@ -23,5 +23,5 @@ module "orc-cs-0" {
prefix = local.prefix_orc
location = var.location_config.region
storage_class = "REGIONAL"
encryption_key = try(local.service_encryption_keys.storage != null, false) ? try(local.service_encryption_keys.storage, null) : null
encryption_key = try(local.service_encryption_keys.storage, null)
}

View File

@ -39,7 +39,7 @@ module "trf-cs-df-0" {
prefix = local.prefix_trf
location = var.location_config.region
storage_class = "REGIONAL"
encryption_key = try(local.service_encryption_keys.storage != null, false) ? try(local.service_encryption_keys.storage, null) : null
encryption_key = try(local.service_encryption_keys.storage, null)
}
# Bigquery

View File

@ -21,7 +21,7 @@ module "dtl-0-bq-0" {
project_id = module.dtl-0-prj.project_id
id = "${replace(local.prefix_dtl, "-", "_")}_0_bq_0"
location = var.location_config.region
encryption_key = try(local.service_encryption_keys.bq != null, false) ? try(local.service_encryption_keys.bq, null) : null
encryption_key = try(local.service_encryption_keys.bq, null)
}
module "dtl-1-bq-0" {
@ -29,7 +29,7 @@ module "dtl-1-bq-0" {
project_id = module.dtl-1-prj.project_id
id = "${replace(local.prefix_dtl, "-", "_")}_1_bq_0"
location = var.location_config.region
encryption_key = try(local.service_encryption_keys.bq != null, false) ? try(local.service_encryption_keys.bq, null) : null
encryption_key = try(local.service_encryption_keys.bq, null)
}
module "dtl-2-bq-0" {
@ -37,7 +37,7 @@ module "dtl-2-bq-0" {
project_id = module.dtl-2-prj.project_id
id = "${replace(local.prefix_dtl, "-", "_")}_2_bq_0"
location = var.location_config.region
encryption_key = try(local.service_encryption_keys.bq != null, false) ? try(local.service_encryption_keys.bq, null) : null
encryption_key = try(local.service_encryption_keys.bq, null)
}
module "dtl-exp-bq-0" {
@ -45,7 +45,7 @@ module "dtl-exp-bq-0" {
project_id = module.dtl-exp-prj.project_id
id = "${replace(local.prefix_dtl, "-", "_")}_exp_bq_0"
location = var.location_config.region
encryption_key = try(local.service_encryption_keys.bq != null, false) ? try(local.service_encryption_keys.bq, null) : null
encryption_key = try(local.service_encryption_keys.bq, null)
}
# Cloud storage
@ -57,7 +57,7 @@ module "dtl-0-cs-0" {
prefix = local.prefix_dtl
location = var.location_config.region
storage_class = "REGIONAL"
encryption_key = try(local.service_encryption_keys.storage != null, false) ? try(local.service_encryption_keys.storage, null) : null
encryption_key = try(local.service_encryption_keys.storage, null)
force_destroy = var.data_force_destroy
}
@ -68,7 +68,7 @@ module "dtl-1-cs-0" {
prefix = local.prefix_dtl
location = var.location_config.region
storage_class = "REGIONAL"
encryption_key = try(local.service_encryption_keys.storage != null, false) ? try(local.service_encryption_keys.storage, null) : null
encryption_key = try(local.service_encryption_keys.storage, null)
force_destroy = var.data_force_destroy
}
@ -79,7 +79,7 @@ module "dtl-2-cs-0" {
prefix = local.prefix_dtl
location = var.location_config.region
storage_class = "REGIONAL"
encryption_key = try(local.service_encryption_keys.storage != null, false) ? try(local.service_encryption_keys.storage, null) : null
encryption_key = try(local.service_encryption_keys.storage, null)
force_destroy = var.data_force_destroy
}
@ -90,6 +90,6 @@ module "dtl-exp-cs-0" {
prefix = local.prefix_dtl
location = var.location_config.region
storage_class = "REGIONAL"
encryption_key = try(local.service_encryption_keys.storage != null, false) ? try(local.service_encryption_keys.storage, null) : null
encryption_key = try(local.service_encryption_keys.storage, null)
force_destroy = var.data_force_destroy
}