{"action":"created","issue":{"url":"https://api.github.com/repos/hashicorp/terraform/issues/4273","repository_url":"https://api.github.com/repos/hashicorp/terraform","labels_url":"https://api.github.com/repos/hashicorp/terraform/issues/4273/labels{/name}","comments_url":"https://api.github.com/repos/hashicorp/terraform/issues/4273/comments","events_url":"https://api.github.com/repos/hashicorp/terraform/issues/4273/events","html_url":"https://github.com/hashicorp/terraform/issues/4273","id":121788490,"number":4273,"title":"Can't use heredoc with AWS SQS policy","user":{"login":"b-ryan","id":1183997,"avatar_url":"https://avatars.githubusercontent.com/u/1183997?v=3","gravatar_id":"","url":"https://api.github.com/users/b-ryan","html_url":"https://github.com/b-ryan","followers_url":"https://api.github.com/users/b-ryan/followers","following_url":"https://api.github.com/users/b-ryan/following{/other_user}","gists_url":"https://api.github.com/users/b-ryan/gists{/gist_id}","starred_url":"https://api.github.com/users/b-ryan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/b-ryan/subscriptions","organizations_url":"https://api.github.com/users/b-ryan/orgs","repos_url":"https://api.github.com/users/b-ryan/repos","events_url":"https://api.github.com/users/b-ryan/events{/privacy}","received_events_url":"https://api.github.com/users/b-ryan/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/hashicorp/terraform/labels/bug","name":"bug","color":"f7c6c7"},{"url":"https://api.github.com/repos/hashicorp/terraform/labels/provider/aws","name":"provider/aws","color":"bfdadc"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-12-11T20:46:36Z","updated_at":"2016-03-08T22:22:48Z","closed_at":null,"body":"When I use a heredoc, the policy always appears to have changed. Example:\r\n\r\n```\r\nresource \"aws_sqs_queue\" \"test\" {\r\n  name = \"test\"\r\n\r\n  policy = <<EOF\r\n{\r\n    \"Version\": \"2012-10-17\",\r\n    \"Id\": \"test\",\r\n    \"Statement\": [\r\n        {\r\n            \"Sid\": \"\",\r\n            \"Effect\": \"Allow\",\r\n            \"Principal\": {\"AWS\": \"*\"},\r\n            \"Action\": \"SQS: SendMessage\",\r\n            \"Resource\": \"arn:aws:sqs:us-east-1:blahblah:test\",\r\n            \"Condition\": {\r\n                \"ArnEquals\": {\r\n                    \"aws: SourceArn\": \"sns_arn\"\r\n                }\r\n            }\r\n        }\r\n    ]\r\n}\r\nEOF\r\n}\r\n```\r\n\r\nAfter 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.\r\n\r\nI assume the fix here would be to strip whitespace from the resource."},"comment":{"url":"https://api.github.com/repos/hashicorp/terraform/issues/comments/193996061","html_url":"https://github.com/hashicorp/terraform/issues/4273#issuecomment-193996061","issue_url":"https://api.github.com/repos/hashicorp/terraform/issues/4273","id":193996061,"user":{"login":"nicolai86","id":111324,"avatar_url":"https://avatars.githubusercontent.com/u/111324?v=3","gravatar_id":"","url":"https://api.github.com/users/nicolai86","html_url":"https://github.com/nicolai86","followers_url":"https://api.github.com/users/nicolai86/followers","following_url":"https://api.github.com/users/nicolai86/following{/other_user}","gists_url":"https://api.github.com/users/nicolai86/gists{/gist_id}","starred_url":"https://api.github.com/users/nicolai86/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nicolai86/subscriptions","organizations_url":"https://api.github.com/users/nicolai86/orgs","repos_url":"https://api.github.com/users/nicolai86/repos","events_url":"https://api.github.com/users/nicolai86/events{/privacy}","received_events_url":"https://api.github.com/users/nicolai86/received_events","type":"User","site_admin":false},"created_at":"2016-03-08T22:22:47Z","updated_at":"2016-03-08T22:22:47Z","body":"@b-ryan @rsutton1 @aflury @r39132 could you check if the changes made here fix your issue: https://github.com/nicolai86/terraform/tree/bugfix/compact-sqs-queue-json ? you need to build the aws provider locally using `make plugin-dev PLUGIN=provider-aws`.."}}