-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
Error inserting cache behaviour into existing cloudfront distribution: InvalidArgument: The parameter QueryString cannot be false if query strings are set in QueryStringCacheKeys #17879
Comments
It still works with hashicorp/aws provider version 3.27.0. and fails starting with 3.28.0. |
It seems to be a general problem that existing ordered_cache_behaviors (for Cloudfront Distributions set up with Terraform before 3.28.0) might get attributes screwed up when another ordered_cache_behavior is inserted before it and the applied with aws provider 3.28.0 or greater. We had the problem that an ordered_cache_behavior suddenly had a max_ttl of 0, which was not configured on this ordered_cache_behavior but on one above it, leading to not caching responses for this ordered_cache_behavior any more. |
We seem to have experienced this issue, or something related with v3.37.0: A new |
Hi @ronaldploeger, do you have any idea how to fix this? |
We hit the same problem when adding a new ordered cache behaviour in the middle of other ordered behaviours, one of which had The workaround was to explicitly add:
to all the ordered cache behaviours where |
We're experiencing this issue too. Documentation clearly states:
One of our ordered_cache_behavior {
target_origin_id = "origin-id"
viewer_protocol_policy = "redirect-to-https"
allowed_methods = ["GET", "HEAD"]
cached_methods = ["GET", "HEAD"]
path_pattern = "/path"
forwarded_values {
headers = ["Host"]
query_string = true
cookies {
forward = "whitelist"
whitelisted_names = [
"yleconsent",
]
}
}
min_ttl = 0
default_ttl = 60
max_ttl = 31536000
compress = true
} In state however, there are query string cache keys: ordered_cache_behavior {
allowed_methods = [
"GET",
"HEAD",
]
cached_methods = [
"GET",
"HEAD",
]
compress = true
default_ttl = 60
max_ttl = 31536000
min_ttl = 0
path_pattern = "/path"
smooth_streaming = false
target_origin_id = "origin-id"
trusted_key_groups = []
trusted_signers = []
viewer_protocol_policy = "redirect-to-https"
forwarded_values {
headers = []
query_string = true
query_string_cache_keys = [
"_c",
"play",
"t",
]
cookies {
forward = "none"
whitelisted_names = []
}
}
} |
Marking this issue as stale due to inactivity. This helps our maintainers find and focus on the active issues. If this issue receives no comments in the next 30 days it will automatically be closed. Maintainers can also remove the stale label. If this issue was automatically closed and you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thank you! |
Community Note
Terraform CLI and Terraform AWS Provider Version
Terraform v0.14.7
provider registry.terraform.io/hashicorp/aws v3.30.0
Affected Resource(s)
Terraform Configuration Files
Debug Output
Relevent part in request:
<QueryString>false</QueryString><QueryStringCacheKeys><Items><Name>test2</Name></Items><Quantity>1</Quantity></QueryStringCacheKeys>
Expected Behavior
A new cache behaviour should have been added to an existing cloud front distribution.
Actual Behavior
Adding a new "ordered_cache_behavior" above existing cache behaviours leads to error:
Error: error updating CloudFront Distribution (EV91UAAN6RJSZ): InvalidArgument: The parameter QueryString cannot be false if query strings are set in QueryStringCacheKeys.
status code: 400, request id: ddbd3535-af79-40be-8536-e390e1c4d536
When I look at the terraform state of the cloudfront_distribution resource after the failed apply I can see that:
a) the new cache behaviour "/test1" appears
b) the state for the cache behaviour "/test20" is incorrect: "query_string" is set to false but there is also a non empty "query_string_cache_keys" (which it somehow "inherited" from the next cache behaviour "/test30")
Steps to Reproduce
terraform apply
terraform state show aws_cloudfront_distribution.test
terraform apply
--> which will failterraform state show aws_cloudfront_distribution.test
The text was updated successfully, but these errors were encountered: