-
Notifications
You must be signed in to change notification settings - Fork 1
feat: add CloudFront component #84
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: master
Are you sure you want to change the base?
Conversation
ed85a45 to
bd7c17c
Compare
bd7c17c to
5ec97e1
Compare
5ec97e1 to
af2a951
Compare
Exposing CloudFront as a independent component adds flexibility and supports use cases such as multiple origins per distribution. Three types of behaviors are supported: - S3, tailored for S3 origins with auto-configuration including cache policy oriented towards static assets and response headers policy with security headers. - LB, tailored for ALB origins with auto-configuration including cache policy for dynamic content and response headers policy with security headers. - Custom, configurable option with by default disabled caching.
af2a951 to
462b9e8
Compare
| export class CloudFront extends pulumi.ComponentResource { | ||
| name: string; | ||
| distribution: aws.cloudfront.Distribution; | ||
| acmCertificate?: AcmCertificate; |
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.
Here we are exposing the acmCertificate prop but in a case where we send a certificate, this prop will be undefined. Would it be better to unify them both under one prop?
| export enum BehaviorType { | ||
| S3 = 's3', | ||
| LB = 'lb', | ||
| CUSTOM = 'custom', | ||
| } |
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.
Would it make sense to move this to types.ts?
| cachePolicy: aws.cloudfront.CachePolicy; | ||
| originRequestPolicy?: aws.cloudfront.OriginRequestPolicy; | ||
| responseHeadersPolicy?: aws.cloudfront.ResponseHeadersPolicy; | ||
| getPathConfig: () => aws.types.input.cloudfront.DistributionOrderedCacheBehavior; |
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.
do we need this method, i don't see it being used anywhere?
| pathPattern: string; | ||
| config: aws.types.input.cloudfront.DistributionDefaultCacheBehavior; | ||
| cachePolicy: aws.cloudfront.CachePolicy; | ||
| originRequestPolicy?: aws.cloudfront.OriginRequestPolicy; |
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.
Do we need this since it’s not being set anywhere?
I see we already have an originRequestPolicyId though.
| orderedCaches, | ||
| domain, | ||
| certificate, | ||
| defaultRoot, |
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 name this defaultRootObject as the prop name?
| private createDistributionOrigins( | ||
| behaviors: CloudFront.Args['behaviors'], | ||
| ): pulumi.Output<aws.types.input.cloudfront.DistributionOrigin[]> { | ||
| return pulumi.all(behaviors.map(b => pulumi.output(b))).apply(entries => { |
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.
| return pulumi.all(behaviors.map(b => pulumi.output(b))).apply(entries => { | |
| return pulumi.output(behaviors).apply(entries => { |
Exposing CloudFront as a independent component adds flexibility and supports use cases such as multiple origins per distribution. Three types of behaviors are supported: