0.10.7, 0.9.11
resource "aws_iam_policy" "nodes_sqs_policy" {
name = "nodes_sqs_policy"
description = "nodes SQS"
policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"sqs:GetQueueAttributes"
],
"Resource": [
"arn:aws:sqs:us-east-1:123123123:myapp-dev-us-east-1*"
]
}
]
}
EOF
}
The policy was applied
1 error(s) occurred:
* aws_iam_policy.nodes_sqs_policy: "policy" contains an invalid JSON policy
Removing the whitespace before the first character in the policy allows it to be applied:
data "template_file" "nodes_iam_sqs" {
name = "nodes_sqs_policy"
description = "nodes SQS"
policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"sqs:GetQueueAttributes"
],
"Resource": [
"arn:aws:sqs:us-east-1:123123123:myapp-dev-us-east-1*"
]
}
]
}
EOF
}
According to RFC 4627, "Insignificant whitespace is allowed before or after any of the six structural characters."
Aaand this is in the wrong repo.
just ran into this issue, thanks
lame. Can we please fix? Thanks
The AWS provider has moved out of the main terraform repo, and this bug report has moved here: https://github.com/terraform-providers/terraform-provider-aws/issues/1873
I had the same problem and got it fixed by removing all the spaces before the left curly brace that is immediately after the <
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.
Most helpful comment
The AWS provider has moved out of the main terraform repo, and this bug report has moved here: https://github.com/terraform-providers/terraform-provider-aws/issues/1873