Skip to content

Commit

Permalink
chore: consolidate locals
Browse files Browse the repository at this point in the history
  • Loading branch information
johncblandii committed Nov 5, 2021
1 parent 7372db1 commit e8aaec4
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ locals {
logging_bucket_enabled = local.bucket_enabled && var.logging_bucket_enabled
logging_bucket_name_default = try(var.logging["bucket_name"], "${local.bucket_name}-logs")
logging_prefix_default = try(var.logging["prefix"], "logs/")
logging_bucket_name = local.logging_bucket_enabled ? module.log_storage.bucket_id : local.logging_bucket_name_default
logging_prefix = local.logging_bucket_enabled ? module.log_storage.prefix : local.logging_prefix_default
}

data "aws_iam_policy_document" "prevent_unencrypted_uploads" {
Expand Down Expand Up @@ -151,11 +153,6 @@ module "log_storage" {
context = module.this.context
}

locals {
logging_bucket_name = local.logging_bucket_enabled ? module.log_storage.bucket_id : local.logging_bucket_name_default
logging_prefix = local.logging_bucket_enabled ? module.log_storage.prefix : local.logging_prefix_default
}

resource "aws_s3_bucket" "default" {
count = local.bucket_enabled ? 1 : 0

Expand Down

0 comments on commit e8aaec4

Please sign in to comment.