-
Notifications
You must be signed in to change notification settings - Fork 0
Feat/platform 696: accept custom cloudfront distribution #33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
oscar-dbbs
commented
Aug 16, 2024
- if custom cloudfront was passed, avoid creating new cloudfront and use existing instead
- attach origin, update existing behavior and add additional behaviors for existing cloudfront together with lambda edge
additionalBehaviors: { | ||
['/_next/data/*']: { | ||
if (customCloudFrontId && customCloudFrontDomainName) { | ||
this.cf = cloudfront.Distribution.fromDistributionAttributes(this, id, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we also need to add new rules and lambda to existing cloudfront
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can call this.cf.addBehaviour
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, this isn't supported by the cloudformation stack. we can only add existing id to the cloud formation template (which is what I did here by setting it to the output).
aws/aws-cdk#12524
@@ -190,6 +204,18 @@ export const deploy = async (config: DeployConfig) => { | |||
VersionLabel: versionLabel | |||
}) | |||
|
|||
// if custom cf distribution, update it | |||
if (customCFDistribution) { | |||
await updateDistribution(cloudfrontClient, customCFDistribution, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should do that inside stack, otherwise we will keep changing cloudfront with each deployment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as the above comment. I searched and there is no way to update the distribution inside the stack.
aws/aws-cdk#12524
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we check at least that those origins and rules were already added, so we can skip that step?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will create a function to check this then.
32bc4ac
to
90d3316
Compare