-
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
provider/aws: Validate effect
in aws_iam_policy_document data source
#10021
provider/aws: Validate effect
in aws_iam_policy_document data source
#10021
Conversation
effect
in aws_iam_policy_document data sourceeffect
in aws_iam_policy_document data source
Thanks for this, @dougneal. Seems like a very sensible addition! Do you think it would be clearer to write this as a switch statement instead of a set of if branches? switch v.(string) {
case "Allow", "Deny":
// ...
default:
// ...
} My eye likes the compactness of this, but that's pretty subjective. What do you think? |
Thanks @apparentlymart, I agree, that's neater. Will change. |
AWS allows only the case-sensitive strings `Allow` and `Deny` to appear in the `Effect` fields of IAM policy documents. Catch deviations from this, including mis-casing, before hitting the API and generating an error (the error is a generic 400 and doesn't indicate what part of the policy doc is invalid).
846579b
to
338c34b
Compare
Thanks for the update, @dougneal. I was planning to merge this but I'm on the road right now and I just found that my laptop has a stale version of Go that can't build Terraform to run the tests, so I'll need to leave this for someone else to look at or until I have a chance to build a new Go version. Sorry for the delay. |
Hi @dougneal (and @apparentlymart) I just looked at this and tested it - LGTM! Thanks for the work here :)
Paul |
Thanks @stack72! In terms of forward-porting this to 0.8, would another PR be helpful? |
It will be in 0.8 by default :) 0.8 is being built from master |
The PR was targeted at |
ok, I am going to revert that - can you then retarget it to master? |
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. |
AWS allows only the case-sensitive strings
Allow
andDeny
to appear in theEffect
fields of IAM policy documents. Catch deviations from this, including mis-casing, before hitting the API and generating an error (the error is a generic 400 and doesn't indicate what part of the policy doc is invalid).