hello how to invalidate Cloudfront distribution ca...
# aws
hello how to invalidate Cloudfront distribution cache after updating S3 files ?
I have this hack after I create a cf distribution because there doesn't appear to be a pulumi primitive for this in the aws provider. golang:
_ = cfDist.ID().ToStringOutput().ApplyT(func(id string) string {
invalidateCfCache(id, resCtx.region)
return fmt.Sprintf("%v", id)
the cleaner way to do this is with a dynamic provider (https://www.pulumi.com/blog/dynamic-providers/) but these are only supported in python/javascript and I'm in golang.
^ invalidateCfCache() above here is just using the aws SDK directly
im using typescript/javascript
check out the dynamic provider link then that's probably a better option for you
okay thank you and where do you find
fn ?
I tried to use
in my pulumi script, but this part of the code tries to run during preview.. any doc about how to make it work like a pulumi resource ?
oh that's my code. it's just a wrapper around the AWS SDK. here's the js link: https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/CloudFront.html#createInvalidation-property
re: make it work like a pulumi resource, yeah that's what the dynamic provider is designed for; see the link above to the pulumi docs
🙏 1