-
Notifications
You must be signed in to change notification settings - Fork 9.7k
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
terraform attempts to modify again and again an s3 bucket defined with a policy including a CanonicalUser #6642
Comments
we're having a similar issue since upgrading to terraform
|
This is I believe a different issue with the fact that aws always generates a Sid for policy, and if you don't have one in your aws_s3_bucket then terraform will think that the policy changed. To solve, just add: 'Sid: "" ' to your bucket policy. |
@giladwolff I double checked and it looks like our policy already has the SID specified. Here's what our config for that policy looks like:
and here our the resources that use that policy.
|
My bad. I somehow missed the Sid = "1" in the 'to' policy. The only thing I can think of is the make the order in the policy statement the same as what aws renders it and see if it works. |
I've done that too a few times, trying to reorder to what terraform is trying to change it to, and it will work for a few days before the order gets changed again. I gave up on trying to keep up with the ordering of the policies after a few attempts. |
+1 to this. I've also reordered ours and it changed to something else a few days later. |
Everyone, I have found this as well, and from what I've seen the main issue is that AWS is converting the In the meantime, you can also generate this ARN manually with the appropriate ARN base and the |
I'm also having this issue, it seems to be occurring with any aws_s3_bucket_policy type no matter what the policy is. |
Is there any update on this. I am giving the same exact policy after importing the bucket into state file, but when I run the plan it shows two things in plan
|
I have this issue too for one of our clients, any help or workaround available for this ? here my resource declaration :
|
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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Terraform Version
0.6.15
Affected Resource(s)
Please list the resources as a list, for example:
Terraform Configuration Files
This is the policy from the s3 bucket I'm setting up:
Debug Output
Expected Behavior
Terraform should not attempt to modify the s3 bucket as the AWS principal and the CanonicalUser principal are the same principal referred to by different names.
Actual Behavior
Terrafrom is trying to modify the s3 bucket policy.
Steps to Reproduce
Please list the steps required to reproduce the issue, for example:
terraform plan
to see that terraform is going to modify the s3 bucket policy.Important Factoids
The CloudFront origin access id was created by terraform as well.
Workaround
I now "resolve" the name myself and use 'format' to generate the principal arn:
The text was updated successfully, but these errors were encountered: