Comments (3)
Hi @mivtachyahu , could you provider an example or reproduction of your program? Also, what language are you using – it looks like 0's should be the correct default value for these attributes in each language regardless
from pulumi-aws.
Hi @aq17 - I'm using TypeScript.
Here's an example piece of code with minTtl / maxTtl / defaultTtl values unset:
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const bucket = new aws.s3.Bucket("myBucket");
const distributionArgs: aws.cloudfront.DistributionArgs = {
enabled: true,
origins: [{
domainName: bucket.bucketRegionalDomainName,
originId: bucket.arn,
}],
defaultCacheBehavior: {
targetOriginId: bucket.arn,
viewerProtocolPolicy: "redirect-to-https",
allowedMethods: ["GET", "HEAD", "OPTIONS"],
cachedMethods: ["GET", "HEAD", "OPTIONS"],
forwardedValues: {
cookies: {
forward: 'none',
},
queryString: false,
},
},
restrictions: {
geoRestriction: {
restrictionType: "none",
},
},
viewerCertificate: {
cloudfrontDefaultCertificate: true,
}
};
const cdn = new aws.cloudfront.Distribution("cdn", distributionArgs);
export const cdnUrl = cdn.domainName;
Which yields this config in the aws console:
On a whim I decided to update the example above with the default values for maxTtl / defaultTtl from reading the aws-sdk code and a 0 of minTtl:
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const bucket = new aws.s3.Bucket("myBucket");
const distributionArgs: aws.cloudfront.DistributionArgs = {
enabled: true,
origins: [{
domainName: bucket.bucketRegionalDomainName,
originId: bucket.arn,
}],
defaultCacheBehavior: {
targetOriginId: bucket.arn,
viewerProtocolPolicy: "redirect-to-https",
allowedMethods: ["GET", "HEAD", "OPTIONS"],
cachedMethods: ["GET", "HEAD", "OPTIONS"],
forwardedValues: {
cookies: {
forward: 'none',
},
queryString: false,
},
minTtl: 0,
defaultTtl: 86400,
maxTtl: 31536000,
},
restrictions: {
geoRestriction: {
restrictionType: "none",
},
},
viewerCertificate: {
cloudfrontDefaultCertificate: true,
}
};
const cdn = new aws.cloudfront.Distribution("cdn", distributionArgs);
// Export the CloudFront distribution domain name
export const cdnUrl = cdn.domainName;
And it turns out this does yield the config setting that I was after in AWS
But that behaviour isn't documented anywhere, and I assume it's probably the bug that they probably should have the default values from the aws-sdk if they're not set instead of 0s?
from pulumi-aws.
I believe this is tracked upstream in hashicorp/terraform-provider-aws#19382 which was recently closed with a doc change:
To achieve the setting of 'Use origin cache headers' without a linked cache policy, use the following TTL values: min_ttl = 0, max_ttl = 31536000, default_ttl = 86400. See this issue for additional context.
Since the upstream decided not to fix this, I think I'll go ahead and close this issue by design as well.
from pulumi-aws.
Related Issues (20)
- AWS_SKIP_CREDENTIALS_VALIDATION doesn't work HOT 2
- Epic: Lambda Builders HOT 1
- Upgrade terraform-provider-aws to v5.51.0 HOT 1
- Importing aws:ec2/routeTable:RouteTable produces resource with ipv6Cidr resource with empty string resulting in invalid CIDR address error HOT 4
- Upgrade terraform-provider-aws to v5.51.1
- Workflow failure: cron HOT 3
- EKS cluster parameter `bootstrapClusterCreatorAdminPermissions` has wrong default HOT 1
- Workflow failure: release HOT 1
- Opaque error message emitted for unrecognized aws:endpoints
- Upgrade terraform-provider-aws to v5.52.0
- Node Overlay Inventory
- PF Resources missing `.ComputeID` HOT 4
- FLAKE: TestAccWebserverPy/webserver-py
- aws.ssm.getParameter doesn't return value HOT 7
- TestJobQueueUpgrade panics under PlanResourceChange HOT 7
- PATCH 0059-Fix-static-get-function-for-ssm.parameter-with-versi.patch
- Workflow failure: release HOT 1
- Workflow failure: release HOT 1
- Cannot import resources when provider has default tasg
- iam.Role.inlinePolicies are not removed when they are changed to empty list/None
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pulumi-aws.