From 20162b84fa6b5562b2580d4db3802657d67caeaf Mon Sep 17 00:00:00 2001 From: amila-ku Date: Wed, 18 Sep 2024 10:38:27 +0100 Subject: [PATCH 1/4] fix: fixes broken replication name --- replication.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/replication.tf b/replication.tf index da46d23b..e6aa043c 100644 --- a/replication.tf +++ b/replication.tf @@ -1,7 +1,7 @@ resource "aws_iam_role" "replication" { count = local.replication_enabled ? 1 : 0 - name = format("%s-replication", module.this.id) + name = "${aws_s3_bucket.default[0].id}-replication" assume_role_policy = data.aws_iam_policy_document.replication_sts[0].json permissions_boundary = var.s3_replication_permissions_boundary_arn @@ -28,7 +28,7 @@ data "aws_iam_policy_document" "replication_sts" { resource "aws_iam_policy" "replication" { count = local.replication_enabled ? 1 : 0 - name = format("%s-replication", module.this.id) + name = "${aws_s3_bucket.default[0].id}-replication" policy = data.aws_iam_policy_document.replication[0].json tags = module.this.tags From 93b4aac9ee12aa881c54afe90fe5f063d00bf89e Mon Sep 17 00:00:00 2001 From: Amila Kumaranayaka Date: Sat, 28 Sep 2024 02:52:18 +0100 Subject: [PATCH 2/4] fix: use local value Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com> --- replication.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/replication.tf b/replication.tf index e6aa043c..538f2f56 100644 --- a/replication.tf +++ b/replication.tf @@ -1,7 +1,7 @@ resource "aws_iam_role" "replication" { count = local.replication_enabled ? 1 : 0 - name = "${aws_s3_bucket.default[0].id}-replication" + name = format("%s-replication, local.bucket_name) assume_role_policy = data.aws_iam_policy_document.replication_sts[0].json permissions_boundary = var.s3_replication_permissions_boundary_arn From 920aef6daea165966a9006a46c13c7a510dceffd Mon Sep 17 00:00:00 2001 From: Amila Kumaranayaka Date: Sat, 28 Sep 2024 02:53:06 +0100 Subject: [PATCH 3/4] fix: use bucket name from local Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com> --- replication.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/replication.tf b/replication.tf index 538f2f56..44afd8b6 100644 --- a/replication.tf +++ b/replication.tf @@ -28,7 +28,7 @@ data "aws_iam_policy_document" "replication_sts" { resource "aws_iam_policy" "replication" { count = local.replication_enabled ? 1 : 0 - name = "${aws_s3_bucket.default[0].id}-replication" + name = format("%s-replication, local.bucket_name) policy = data.aws_iam_policy_document.replication[0].json tags = module.this.tags From 34f92799e892a0d5cf2d919519162ac00b40786c Mon Sep 17 00:00:00 2001 From: RB <7775707+nitrocode@users.noreply.github.com> Date: Wed, 13 Nov 2024 07:36:55 -0600 Subject: [PATCH 4/4] fix(replication): missing quote, created local --- replication.tf | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/replication.tf b/replication.tf index 44afd8b6..ee1d7671 100644 --- a/replication.tf +++ b/replication.tf @@ -1,7 +1,11 @@ +locals { + replication_role = format("%s-replication", local.bucket_name) +} + resource "aws_iam_role" "replication" { count = local.replication_enabled ? 1 : 0 - name = format("%s-replication, local.bucket_name) + name = local.replication_role assume_role_policy = data.aws_iam_policy_document.replication_sts[0].json permissions_boundary = var.s3_replication_permissions_boundary_arn @@ -28,7 +32,7 @@ data "aws_iam_policy_document" "replication_sts" { resource "aws_iam_policy" "replication" { count = local.replication_enabled ? 1 : 0 - name = format("%s-replication, local.bucket_name) + name = local.replication_role policy = data.aws_iam_policy_document.replication[0].json tags = module.this.tags