-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
Can't use heredoc with AWS SQS policy #4273
Comments
Hi @b-ryan! Thanks for reporting this - I have a feeling we are missing normalisation of the JSON as is applied in several other resources with policies - for example
|
Hi @jen20 -- thanks. I thought a function like that might exist. I'll try to fix this if I have some time. |
Chiming in that this doesn't just apply to heredoc type vars. I have a queue policy that looks like
that also hits this. |
Hi Folks! |
+1 (Disclosure: I work with @r39132 ). It seems like the fix is simple. I came up with the exact fix that @chancefeick did before noticing that he had already done so. |
👍 on this (disclosure: I work with @b-ryan ) I'm currently seeing this bug when trying to get my policy in Terraform to match the policy currently in AWS. The policies are the same, however Terraform shows a policy change just because the whitespace is off. It looks like there's no way to get the whitespace to match without changing Terraform. I set the policy in Terraform to be the same as the AWS policy, yet Terraform is giving a diff in the
As the If Terraform could normalize JSON in the same way as AWS, this problem would be fixed. |
Hey there, this issue seems to be fixed since 0.6.15 (#5888). It does not occur for me anymore. |
We're on 0.6.16 and it still tells us it's going to change the policy every single time. Maybe there is something different about what we're doing. It happens on our SQS queues. |
This still appears to be an issue. On 0.6.16 and it still looks to modify SNS resources with EOF of JSON |
We're still having this issue in 0.7.11. I spent some time poking at it this week and I think there are two reasons we're experiencing it. First, terraform doesn't seem to be normalizing the json it creates from Second, terraform doesn't seem to be respecting the schema options on policy documents during diffing. Ie, adding I have a working fix for the first problem, which is to wrap the output of dataSourceAwsIamPolicyDocumentRead in normalizeJsonString(), and I'll PR that tonight. I'm not really sure what to do about the second problem though and I'd super-appreciate some guidance from someone who understands the diffing code-paths and might know off the top of their head what happens internally when an iam policy generated from a policy_document in the local config is compared to json gleaned from the aws api. 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 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. |
When I use a heredoc, the policy always appears to have changed. Example:
After creating this, terraform tells me the policy needs to change in the next plan. This appears to be due to this policy containing newline characters and spaces. I think AWS strips all whitespace characters from the policy. Doing
aws sqs get-queue-attributes --attribute-names Policy --queue-url https://...
gives me a policy without any whitespace characters.I assume the fix here would be to strip whitespace from the resource.
The text was updated successfully, but these errors were encountered: