-
Notifications
You must be signed in to change notification settings - Fork 9.1k
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
Applying tags to S3 bucket tries to remove system (aws:*) tags #7323
Comments
Note that around L23 in https://github.com/terraform-providers/terraform-provider-aws/blob/master/aws/s3_tags.go#L23 |
@dave2 Interestingly, you don't get this error if there are also tags to be deleted, in which case https://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketDELETEtagging.html is called first and the system tags are deleted by this call. The subsequent call to https://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUTtagging.html then succeeds but of course the system tags are now lost. |
This has been released in version 2.27.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template for triage. Thanks! |
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. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks! |
Community Note
Terraform Version
$ terraform -v
Terraform v0.11.10
Note: I have checked the actual code path in github so it should still be affecting terraform even tho I am not on the latest version.
Affected Resource(s)
Terraform Configuration Files
Debug Output
I've included only the error message as the rest of the output is correct (it builds the list of tags provided in the terraform template, and feeds those to the correct API).
Expected Behavior
Bucket has existing
aws:*
prefix tags due to being created by CloudFormation. These must be preserved over tag updates, because we cannot remove/edit them.Although the AWS API documentation describes PUT Bucket Tagging as "add tags" this is incorrect, the tag set must be the complete set of tags on the bucket including reserved ones, as any tag not present in the list is implied delete.
API doc is here: https://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUTtagging.html
I've confirmed with AWS that the doc is indeed wrong, and you have to provide existing tags to keep them.
Actual Behavior
Reserved tags are filtered from the incoming list, but not preserved on the update, causing the resource to fail to be updated.
Steps to Reproduce
Important Factoids
Nothing magical!
References
AWS API documentation (that is incorrect anyway!): https://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUTtagging.html
The text was updated successfully, but these errors were encountered: