-
Notifications
You must be signed in to change notification settings - Fork 9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prefix is mandatory in aws_s3_bucket_replication_configuration resource #21961
Comments
This looks very similar to this PR from 2018 (for the aws_s3_bucket block) #6344 |
I'm still running into this as of
-> terraform version
Terraform v1.1.1
on linux_amd64
+ provider registry.terraform.io/hashicorp/aws v3.71.0 Terraform configuration (primary to replica)resource "aws_s3_bucket_replication_configuration" "primary_to_replica" {
role = aws_iam_role.replication_primary.arn
bucket = aws_s3_bucket.terraform_state.id
rule {
id = "Primary_To_Replica"
status = "Enabled"
filter {}
delete_marker_replication {
status = "Enabled"
}
existing_object_replication {
status = "Enabled"
}
destination {
bucket = aws_s3_bucket.terraform_state_replica.arn
storage_class = "STANDARD"
}
}
}
Terraform plan (primary to replica)
FWIW, the replica to primary configuration in the same module worked. The only difference is no Terraform configuration (replica to primary)resource "aws_s3_bucket_replication_configuration" "replica_to_primary" {
provider = aws.replica
role = aws_iam_role.replication_replica.arn
bucket = aws_s3_bucket.terraform_state_replica.id
rule {
id = "Replica_To_Primary"
status = "Enabled"
filter {}
delete_marker_replication {
status = "Enabled"
}
destination {
bucket = aws_s3_bucket.terraform_state.arn
storage_class = "STANDARD"
}
}
} Terraform plan (replica to primary)
EDIT: Confirmed removing |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. |
Community Note
Terraform CLI and Terraform AWS Provider Version
Reproduced with two versions:
Terraform 1.0.11 with aws 3.67.0
Terraform 0.13.6 and aws 3.67.0
Affected Resource(s)
Terraform Configuration Files
Expected Behavior
A replication rule should be created with a scope for the entire bucket when "prefix" is not specified or is set to an empty string like in the example above. This is how replication rules behave when creating them within an aws_s3_bucket resource.
Actual Behavior
Terraform apply fails with Invalid XML error:
The only way to avoid this error is to specify something for "prefix", which isn't useful when I want to replicate everything in the bucket.
Additional example
This is the result when I create a replication rule with a prefix of "foo" using terraform, modify it in the console to have no prefix and run "terraform apply". It does not see prefix at all, so it should also accept configuration with no prefix when applying.
Steps to Reproduce
terraform apply
References
The documentation states prefix should be optional:
https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_replication_configuration#prefix
The text was updated successfully, but these errors were encountered: