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

The parameter ForwardedValues cannot be used when a cache policy is associated to the cache behavior #20

Closed
nodomain opened this issue Feb 23, 2021 · 6 comments

Comments

@nodomain
Copy link

Thanks for adding the cache and origin request policy support.

Unfortunately this does not work:

...
  default_cache_behavior = {
    target_origin_id       = "webapp"
    viewer_protocol_policy = "redirect-to-https"

    allowed_methods = ["GET", "HEAD", "OPTIONS"]
    cached_methods  = ["GET", "HEAD"]
    compress        = true

    cache_policy_id          = aws_cloudfront_cache_policy.default.id
    origin_request_policy_id = aws_cloudfront_origin_request_policy.default.id
  }
...

Results in:

Error: error updating CloudFront Distribution (xxx): InvalidArgument: The parameter ForwardedValues cannot be used when a cache policy is associated to the cache behavior.
        status code: 400, request id: 764d6b38-ee58-4e88-bd1a-49d112cc6f7f

I suspect that the block here needs to be added conditionally: https://github.com/terraform-aws-modules/terraform-aws-cloudfront/blob/master/main.tf#L115-L124

Thanks for fixing :)

@nodomain nodomain changed the title he parameter ForwardedValues cannot be used when a cache policy is associated to the cache behavior The parameter ForwardedValues cannot be used when a cache policy is associated to the cache behavior Feb 23, 2021
@nodomain
Copy link
Author

This is obviously a known bug in the Terraform provider, as I learned by reading through #17

hashicorp/terraform-provider-aws#17626

@christiansaiki
Copy link
Contributor

@nodomain This will be probably be fixed with #21

@antonbabenko
Copy link
Member

Fixed in #21

v1.8.0 has been just released.

@antonbabenko
Copy link
Member

antonbabenko commented Apr 23, 2021

PS: We always try to create examples to show the most common solutions 100% working and executable right away.

Check the examples folder in any terraform-aws-modules repo if you ever stuck.

@violenti
Copy link

violenti commented Aug 5, 2022

Hi, in the example of terraform-aws-cloudfront not specify the use of forwarded, only be to use use_forwarded_values as false

@github-actions
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants