Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
max-lobur committed Dec 6, 2021
1 parent d487d6a commit 0aada29
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 13 deletions.
34 changes: 22 additions & 12 deletions examples/complete/replication.tf
Original file line number Diff line number Diff line change
@@ -1,18 +1,30 @@
locals {
replication_enabled = length(var.s3_replication_rules) > 0
extra_rule = local.replication_enabled ? {
id = "replication-test-explicit-bucket"
status = "Enabled"
prefix = "/extra"
priority = 5
destination_bucket = module.s3_bucket_replication_target_extra[0].bucket_arn
} : null
s3_replication_rules = local.replication_enabled ? concat(var.s3_replication_rules, [local.extra_rule]) : null
extra_rules = local.replication_enabled ? [
{
id = "replication-test-explicit-bucket"
status = "Enabled"
prefix = "/extra"
priority = 5
destination_bucket = module.s3_bucket_replication_target_extra[0].bucket_arn
},
{
id = "replication-test-metrics"
status = "Enabled"
prefix = "/with-metrics"
priority = 10
destination = {
account_id = local.account_id
metrics = {
status = "Enabled"
}
}
}
] : []
s3_replication_rules = concat(var.s3_replication_rules, local.extra_rules)
}

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

source = "../../"

user_enabled = true
Expand All @@ -26,8 +38,6 @@ module "s3_bucket_replication_target" {
}

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

source = "../../"

user_enabled = true
Expand Down
2 changes: 1 addition & 1 deletion examples/complete/replication.us-east-2.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ allowed_bucket_actions = [
"s3:AbortMultipartUpload",
]

# Rules will be augmented with an additional bucket rule, so prefix cannot be "/"
# Rules will be augmented with additional test cases, so prefix cannot be "/"
s3_replication_rules = [
{
id = "replication-test"
Expand Down

0 comments on commit 0aada29

Please sign in to comment.