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

Updating CloudFront Cache Policy fails to pass DefaultTTL #1741

Closed
snstanton opened this issue Dec 15, 2021 · 2 comments
Closed

Updating CloudFront Cache Policy fails to pass DefaultTTL #1741

snstanton opened this issue Dec 15, 2021 · 2 comments
Labels
kind/bug Some behavior is incorrect or out of spec resolution/fixed This issue was fixed

Comments

@snstanton
Copy link

Hello!

  • Vote on this issue by adding a 👍 reaction
  • To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already)

Issue details

With a cache policy like this:

        const cachePolicy = new aws.cloudfront.CachePolicy('api-cache-policy', {
            comment: "api requests with CORS caching enabled",
            minTtl: 0,
            defaultTtl: 0,
            maxTtl: 86400,
            parametersInCacheKeyAndForwardedToOrigin: {
                headersConfig: {headerBehavior: "whitelist", headers: {items: headers}},
                cookiesConfig: {cookieBehavior: "none"},
                queryStringsConfig: {queryStringBehavior: "all"}
            }
        })

The creation of the policy works as expected, however subsequent updates fail because the policy is sent without the defualtTtl:

   debug: Updating CloudFront Cache Policy: ({
    debug:   CachePolicyConfig: {
    debug:     Comment: "api requests with CORS caching enabled",
    debug:     MaxTTL: 86400,
    debug:     MinTTL: 0,
    debug:     Name: "api-cache-policy-f7e76dd",
    debug:     ParametersInCacheKeyAndForwardedToOrigin: {
    debug:       CookiesConfig: {
    debug:         CookieBehavior: "none"
    debug:       },
    debug:       EnableAcceptEncodingBrotli: false,
    debug:       EnableAcceptEncodingGzip: false,
    debug:       HeadersConfig: {
    debug:         HeaderBehavior: "whitelist",
    debug:         Headers: {
    debug:           Items: [
    debug:             "Origin",
    debug:             "Accept",
    debug:             "Access-Control-Request-Method",
    debug:             "Accept-Language",
    debug:             "CloudFront-Viewer-Country",
    debug:             "Access-Control-Request-Headers"
    debug:           ],
    debug:           Quantity: 6
    debug:         }
    debug:       },
    debug:       QueryStringsConfig: {
    debug:         QueryStringBehavior: "all"
    debug:       }
    debug:     }
    debug:   },
    debug:   Id: "9d6fb6e8-d6d1-4d9c-888e-27d1dfc1ffa1",
    debug:   IfMatch: "E23ZP02F085DFQ"
    debug: })
    error: 1 error occurred:
    	* updating urn:pulumi:scott::api::aws:cloudfront/cachePolicy:CachePolicy::api-cache-policy: 1 error occurred:
    	* error updating CloudFront Cache Policy (9d6fb6e8-d6d1-4d9c-888e-27d1dfc1ffa1): InvalidArgument: The parameter DefaultTTL is required.
    	status code: 400, request id: 8aadfa77-6a68-4138-b40e-ecd3278ef889

Versions

pulumi v3.17.1
pulumi-aws 4.28.0

@snstanton snstanton added the kind/bug Some behavior is incorrect or out of spec label Dec 15, 2021
@leezen
Copy link
Contributor

leezen commented Dec 18, 2021

This was fixed recently in hashicorp/terraform-provider-aws#21793 and will be picked up on the next release of the provider.

@stack72
Copy link
Contributor

stack72 commented Mar 9, 2022

closing this out as we have since updated to a version that picks this up

@stack72 stack72 added the resolution/fixed This issue was fixed label Mar 9, 2022
@stack72 stack72 closed this as completed Mar 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Some behavior is incorrect or out of spec resolution/fixed This issue was fixed
Projects
None yet
Development

No branches or pull requests

3 participants