Skip to content

Commit

Permalink
fix: conflicting operations on S3 buckets (nozaq#33)
Browse files Browse the repository at this point in the history
Co-authored-by: millionpoundhat <illya.sparkes-santos@rovco.com>

Fixes 'Error putting S3 policy' which appears to be caused by the force_ssl block being applied at the same time as some other policy, adding a depends_on referencing the public access block ensures a clean apply each time (nozaq#33)
  • Loading branch information
millionpoundhat authored Jun 6, 2021
1 parent ae1c7a3 commit f919e7c
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions bucket.tf
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,9 @@ resource "aws_s3_bucket" "replica" {
}

resource "aws_s3_bucket_policy" "state_force_ssl" {
bucket = aws_s3_bucket.state.id
policy = data.aws_iam_policy_document.state_force_ssl.json
depends_on = [aws_s3_bucket_public_access_block.state]
bucket = aws_s3_bucket.state.id
policy = data.aws_iam_policy_document.state_force_ssl.json
}

resource "aws_s3_bucket_public_access_block" "replica" {
Expand Down Expand Up @@ -303,9 +304,10 @@ resource "aws_s3_bucket" "state" {
}

resource "aws_s3_bucket_policy" "replica_force_ssl" {
provider = aws.replica
bucket = aws_s3_bucket.replica.id
policy = data.aws_iam_policy_document.replica_force_ssl.json
depends_on = [aws_s3_bucket_public_access_block.replica]
provider = aws.replica
bucket = aws_s3_bucket.replica.id
policy = data.aws_iam_policy_document.replica_force_ssl.json
}

resource "aws_s3_bucket_public_access_block" "state" {
Expand Down

0 comments on commit f919e7c

Please sign in to comment.