Skip to content
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

Fix CloudFront origin error #514

Merged
merged 5 commits into from
Aug 7, 2018

Conversation

mindstorms6
Copy link
Contributor

@mindstorms6 mindstorms6 commented Aug 6, 2018

When using CloudFront without an origin access identity, we were failing to include the "empty" property S3OriginConfig - this fixes that.

Also adds an integ test and a validate that verifies this.

Should fix #508

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license.

@mindstorms6 mindstorms6 requested a review from eladb August 6, 2018 19:40
When using CloudFront without an origin access identity, we were failing to
inlclude the "empty" property S3OriginConfig - this fixes that.

Also adds an integ test and a validate that verifies this.

Should fix aws#508
@@ -558,6 +567,16 @@ export class CloudFrontWebDistribution extends cdk.Construct {

}

public validate(): string[] {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to add origins after the construct is created (might be a useful feature)? If not, then why not just validate this in the constructor?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't mind validating in the constructor - I just thought that was the point of the validate method.

Is the idea that validate is only used if you have post-constructor modifications? (That makes sense to me, just trying to get a feel for how you see it)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yap. It's a hook that allows you to perform validations just before synthesis. But the sooner you can perform a validation, the better, because the error will include the most context for the user to be able to understand what they did wrong.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Understood. I'll drop the validate for the time being - I don't currently think adding a origin post creation is valuable. (In my mind - it's not.)

If someone opens a pull request later - it's easy enough to add that.

@mindstorms6 mindstorms6 merged commit 436cc6f into aws:master Aug 7, 2018
@mindstorms6 mindstorms6 deleted the 508-cloudfront-origin branch August 7, 2018 21:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Possible error in generated template for CloudFront distributions
2 participants