I think I’ve figured it out…. `policy: pulumi.outp...
# typescript
i
I think I’ve figured it out….
policy: pulumi.output({ … }).apply(v => JSON.stringify(v))
b
@icy-controller-6092 yep that works! there’s two approaches in here: https://github.com/jaxxstorm/pulumi-examples/blob/main/typescript/aws/s3-cloudfront/index.ts
s
I was going to suggest
pulumi.interpolate
as well. 🙂
i
thanks, I didn’t know about
.all().apply
approach, I think I like
.output().apply
the most as there’s less repeating value names previously I’d used
pulumi.interpolate
but kept getting errors as the JSON syntax has to be exact - you must quote all object keys, no trailing commas, etc. And the worst part was you wouldn’t find out about the syntax error until you go to run
up
… and even then it wouldn’t tell you the location of the error, so you’d have to visually scan potentially hundreds of lines of policy JSON to try and find where you did or didn’t leave a comma hehe.