Hey all, I was wondering if anyone knows of a way ...
# aws
h
Hey all, I was wondering if anyone knows of a way to add cache behaviours and origins to an existing cloudfront.Distribution resource so that different stacks can add behaviours/origins to the same distribution? Ideally I was thinking of something analogous to apigatewayv2.Route which attaches a route to an existing gateway, but this doesn't seem to exist for CloudFront distribution behaviours/origins.
b
As far as I'm aware that doesn't exist. You need to give the full cloudfront configuration when you create/update the distribution. One pattern I've used in those cases is move the resource(cloudfront in this case) to another layer. Each stack that needs to add behaviours/origins creates some kind of configuration somewhere central like ssm/s3. The cloudfront layer then fetches that and uses it as part of its create/update.
h
Cheers for the suggestion, most likely will end up implementing that or otherwise restructuring the project to avoid the problem