Skip to content

Commit c5ce5a9

Browse files
authored
Merge branch 'main' into eventbridge
2 parents ffcd380 + dce02f2 commit c5ce5a9

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

replication.tf

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
1-
locals {
2-
replication_role = format("%s-replication", local.bucket_name)
3-
}
4-
51
resource "aws_iam_role" "replication" {
62
count = local.replication_enabled ? 1 : 0
73

8-
name = local.replication_role
4+
name = format("%s-replication", local.bucket_name)
95
assume_role_policy = data.aws_iam_policy_document.replication_sts[0].json
106
permissions_boundary = var.s3_replication_permissions_boundary_arn
117

@@ -32,7 +28,7 @@ data "aws_iam_policy_document" "replication_sts" {
3228
resource "aws_iam_policy" "replication" {
3329
count = local.replication_enabled ? 1 : 0
3430

35-
name = local.replication_role
31+
name = aws_iam_role.replication[0].name
3632
policy = data.aws_iam_policy_document.replication[0].json
3733

3834
tags = module.this.tags
@@ -68,6 +64,7 @@ data "aws_iam_policy_document" "replication" {
6864
resources = toset(concat(
6965
try(length(var.s3_replica_bucket_arn), 0) > 0 ? ["${var.s3_replica_bucket_arn}/*"] : [],
7066
[for rule in local.s3_replication_rules : "${rule.destination_bucket}/*" if try(length(rule.destination_bucket), 0) > 0],
67+
[for rule in local.s3_replication_rules : "${rule.destination.bucket}/*" if try(length(rule.destination.bucket), 0) > 0],
7168
))
7269
}
7370
}

0 commit comments

Comments
 (0)