Skip to content

Commit

Permalink
Clean up locals.
Browse files Browse the repository at this point in the history
  • Loading branch information
korenyoni authored and max-lobur committed Jan 30, 2022
1 parent c2b2ee8 commit b6a9eb7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion examples/complete/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module "s3_bucket" {
allowed_bucket_actions = var.allowed_bucket_actions
bucket_name = var.bucket_name
object_lock_configuration = var.object_lock_configuration
s3_replication_enabled = local.replication_enabled
s3_replication_enabled = local.s3_replication_enabled
s3_replica_bucket_arn = join("", module.s3_bucket_replication_target.*.bucket_arn)
s3_replication_rules = local.s3_replication_rules
privileged_principal_actions = var.privileged_principal_actions
Expand Down
4 changes: 2 additions & 2 deletions examples/complete/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ output "bucket_arn" {
}

output "replication_bucket_id" {
value = local.replication_enabled ? join("", module.s3_bucket_replication_target.*.bucket_id) : null
value = local.s3_replication_enabled ? join("", module.s3_bucket_replication_target.*.bucket_id) : null
description = "Replication bucket ID"
}

output "replication_bucket_arn" {
value = local.replication_enabled ? join("", module.s3_bucket_replication_target.*.bucket_arn) : null
value = local.s3_replication_enabled ? join("", module.s3_bucket_replication_target.*.bucket_arn) : null
description = "Replication bucket bucket ARN"
}

Expand Down
9 changes: 4 additions & 5 deletions examples/complete/replication.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
locals {
replication_enabled = var.s3_replication_enabled
replication_rules = local.replication_enabled ? [
s3_replication_enabled = var.s3_replication_enabled
s3_replication_rules = local.s3_replication_enabled ? [
{
id = "replication-test-explicit-bucket"
status = "Enabled"
Expand Down Expand Up @@ -28,11 +28,10 @@ locals {
}
}
] : []
s3_replication_rules = local.replication_rules
}

module "s3_bucket_replication_target" {
count = local.replication_enabled ? 1 : 0
count = local.s3_replication_enabled ? 1 : 0

source = "../../"

Expand All @@ -47,7 +46,7 @@ module "s3_bucket_replication_target" {
}

module "s3_bucket_replication_target_extra" {
count = local.replication_enabled ? 1 : 0
count = local.s3_replication_enabled ? 1 : 0

source = "../../"

Expand Down

0 comments on commit b6a9eb7

Please sign in to comment.