<@U84SY03DF> How do you feel about adding function...
# general
s
@big-piano-35669 How do you feel about adding functions for common policy type templates to
pulumi-aws
?
For example, every role has the
assume_role_policy
- I have to look up the structure every time.
b
I love it. We have the beginnings of some helpers here, https://github.com/pulumi/pulumi-aws/blob/master/overlays/nodejs/iam/documents.ts, that give you TypeScript schema, so at least you get type-checking. There are three missing pieces, though 1. It's incomplete 2. As you say, factory functions could really cut down on boilerplate 3. The resource types, for the most part, still take JSON serialized strings, so you can't just pass instances directly To fully address 3, we'd need to do https://github.com/pulumi/pulumi-terraform/issues/10, which I know @microscopic-pilot-97530 had looked into at some point but I don't think we ever made progress.
s
I’ll open a pull request for that change then - it’s added to
document
. For now though,
JSON.stringify(assumeRolePolicyForPrincipal("whatever"))
is still an improvement I think.
👍 2
I’ve written that function in terms of the
PolicyDocument
and
Principal
types in
document.ts
, so it should be forward-compatible with pulumi-terraform#10 I’d imagine