FYI, I’ve implemented a typescript package for cre...
# aws
m
FYI, I’ve implemented a typescript package for creating and validating AWS IAM Policy documents. It also parses JSON policy documents and serialises to JSON policy documents. At this stage, it is just the bare minimum that I needed. https://github.com/thinkinglabs/aws-iam-policy
b
wow! Thierry, this is incredible! Would you be interested in writing a blog post for the Pulumi blog about this?
m
euh … you take me by surprise 😅
well, yes, why not 😊
l
Can it produce an aws.iam.PolicyDocument? That form supports Outputs quite well, which JSON doesn't, unfortunately 😞
Increasing the testability of policies is great, they can be quite a hassle normally...
m
No it does not produce
aws.iam.PolicyDocument
But it is an interesting take.
Indeed testing policies is a hassle. That’s the reason I implemented that module. It allows me to unit test a single policy statement.
l
Good stuff. aws.iam.PolicyDocument is good for simplifying the creating of policies but it doesn't really change how testable they are.
m
Well, I first implemented that
aws-iam-policy
package. Then found out about
aws.iam.getPolicyDocument
. Rewrote everything using
getPolicyDocument
. To then find out you have to mock that function to be able to unit test. That was disappointing. I think it was you @little-cartoon-10569 who told me: but you can just assign plain JSON for your policy documents you don’t need
getPolicyDocument
. That’s when I decided to let go on
getPolicyDocument
and go back to my
aws-iam-policy
package.
I got around the Outputs using
apply
while building up the Policy document.
👍 1