Skip to content

Commit

Permalink
Merge pull request #21 from ministryofjustice/fix/replication-provide…
Browse files Browse the repository at this point in the history
…r-references

Added provider references to module
  • Loading branch information
dms1981 authored Mar 1, 2022
2 parents 146b948 + d69a375 commit a83e639
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand All @@ -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"
}
Expand Down

0 comments on commit a83e639

Please sign in to comment.