-
Notifications
You must be signed in to change notification settings - Fork 96
Description
Using the example provided here https://registry.terraform.io/modules/nozaq/remote-state-s3-backend/aws/latest
i.e.
`
module "remote_state" {
source = "nozaq/remote-state-s3-backend/aws"
providers = {
aws = aws
aws.replica = aws.replica
}
}
`
I get the following error when applying:
module.remote_state.aws_s3_bucket_acl.state: Creating...
╷
│ Error: error creating S3 bucket ACL for tf-remote-statexxxxxxxxxxxxxxxxxxx: AccessControlListNotSupported: The bucket does not allow ACLs
│ status code: 400, request id: xxxxxxxx, host id: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx==
│
│ with module.remote_state.aws_s3_bucket_acl.state,
│ on .terraform/modules/remote_state/bucket.tf line 69, in resource "aws_s3_bucket_acl" "state":
│ 69: resource "aws_s3_bucket_acl" "state" {
By changing file remote_state/bucket.tf from:
resource "aws_s3_bucket_acl" "state" {
depends_on = [aws_s3_bucket_ownership_controls.state]
bucket = aws_s3_bucket.state.id
acl = "private"
}
to the following, which add the aws_s3_bucket_owership_controls, and the dependency from acl, the problem is solved.
resource "aws_s3_bucket_ownership_controls" "state" {
bucket = aws_s3_bucket.state.id
rule {
object_ownership = "BucketOwnerPreferred"
}
}
resource "aws_s3_bucket_acl" "state" {
depends_on = [aws_s3_bucket_ownership_controls.state]
bucket = aws_s3_bucket.state.id
acl = "private"
}