diff --git a/main.tf b/main.tf index 771fcd7..d02ab68 100644 --- a/main.tf +++ b/main.tf @@ -191,15 +191,19 @@ resource "aws_s3_bucket" "replication" { # Configure bucket ACL resource "aws_s3_bucket_acl" "replication" { - count = var.replication_enabled ? 1 : 0 - bucket = aws_s3_bucket.replication[count.index].id - acl = "private" + count = var.replication_enabled ? 1 : 0 + + provider = aws.bucket-replication + bucket = aws_s3_bucket.replication[count.index].id + acl = "private" } # Configure bucket lifecycle rules resource "aws_s3_bucket_lifecycle_configuration" "replication" { - count = var.replication_enabled ? 1 : 0 - bucket = aws_s3_bucket.replication[count.index].id + count = var.replication_enabled ? 1 : 0 + + provider = aws.bucket-replication + bucket = aws_s3_bucket.replication[count.index].id rule { id = "main" status = "Enabled" @@ -261,8 +265,10 @@ resource "aws_s3_bucket_policy" "replication" { } resource "aws_s3_bucket_server_side_encryption_configuration" "replication" { - count = var.replication_enabled ? 1 : 0 - bucket = aws_s3_bucket.replication[count.index].id + count = var.replication_enabled ? 1 : 0 + + provider = aws.bucket-replication + bucket = aws_s3_bucket.replication[count.index].id rule { apply_server_side_encryption_by_default { sse_algorithm = "aws:kms" @@ -272,8 +278,10 @@ resource "aws_s3_bucket_server_side_encryption_configuration" "replication" { } resource "aws_s3_bucket_versioning" "replication" { - count = var.replication_enabled ? 1 : 0 - bucket = aws_s3_bucket.replication[count.index].id + count = var.replication_enabled ? 1 : 0 + + provider = aws.bucket-replication + bucket = aws_s3_bucket.replication[count.index].id versioning_configuration { status = (var.versioning_enabled != true) ? "Suspended" : "Enabled" }