-
Notifications
You must be signed in to change notification settings - Fork 24
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
MalformedPolicyDocument: The policy failed legacy parsing #65
Comments
Mind blown. https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_version.html
So terrible. |
Seems like this doesn't work any more. This generates the same error:
|
Additionally, you cannot have an space before the initial "{". |
|
Fails: Works: |
This one saved my ton of time. |
I would've spent all day on this, thank you so much! |
Because of this bug 🐛 (feature?), it's impossible to use resource aws_iam_policy my_iam_policy {
name = "my-sns-name"
policy = trimspace(jsonencode({
"Version" : "2012-10-17"
"Statement" : {
"Sid" : "AllowGiftcodeRedeemSnsIntegration"
"Effect" : "Allow"
"Action" : [
"sns:ConfirmSubscription",
"sns:GetSubscriptionAttributes",
"sns:GetTopicAttributes",
"sns:Publish",
"sns:Subscribe",
"sns:Unsubscribe"
]
"Resource" : ["some::aws:resource"]
}
}))
} results in such plan: |
I tried with square bracket for statement, it worked. Correct way: |
Square brackets makes a list: { https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_statement.html |
For anyone getting this, |
Thank goodness, this appears to have been fixed by some competent person. The docs now say:
|
Thank you. That finally fixed it for me. Be careful with terraformer generated code. It doesn't output statement as a list. |
Thanks so much for this - I almost gave up on AWS CLI |
Ran into a strange issue with this group policy:
Looks like the
Version
key needs to be the first thing. Seems horrible. This works:The text was updated successfully, but these errors were encountered: