-
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
PANIC: interface conversion: interface {} is nil, not map[string]interface {} in aws_cloudfront_cache_policy #21397
Comments
|
Relates: #20870. |
I ran into this issue while trying to setup a TF module for aws_cloudfront_cache_policy. The following is a workaround that prevents this error from popping up when the length of the items field under cookies_config {
cookie_behavior = var.cookie_behavior
# Workaround due to provider bug
# https://github.com/hashicorp/terraform-provider-aws/issues/21397
# cookies {
# items = var.cookies
# }
dynamic "cookies" {
for_each = length(var.cookies) == 0 ? [] : [var.cookies]
content {
items = var.cookies
}
}
}
headers_config {
header_behavior = var.header_behavior
# Workaround due to provider bug
# https://github.com/hashicorp/terraform-provider-aws/issues/21397
# headers {
# items = var.headers
# }
dynamic "headers" {
for_each = length(var.headers) == 0 ? [] : [var.headers]
content {
items = var.headers
}
}
}
query_strings_config {
query_string_behavior = var.query_string_behavior
# Workaround due to provider bug
# https://github.com/hashicorp/terraform-provider-aws/issues/21397
# query_strings {
# items = var.query_strings
# }
dynamic "query_strings" {
for_each = length(var.query_strings) == 0 ? [] : [var.query_strings]
content {
items = var.query_strings
}
}
} I'm guessing what this does is bypass the attempted cast here, that will fail if items is not populated with a valid list of strings, but I'm not sure
|
This functionality has been released in v3.65.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you! |
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. |
Community Note
Terraform CLI and Terraform AWS Provider Version
Terraform v1.0.8
on linux_amd64
Affected Resource(s)
Terraform Configuration Files
Please include all Terraform configurations required to reproduce the bug. Bug reports without a functional reproduction may be closed without investigation.
Debug Output
https://gist.github.com/zaitsevpavel/9fbcb72c43fab7140bbe699582128228
Panic Output
There is no crash.log, just:
Expected Behavior
Resource is created.
Actual Behavior
Panic, resource is not created
Steps to Reproduce
terraform apply
Important Factoids
We use a new resource instead of a managed data-source, because TF always tries to reach AWS even if the flag
-refresh=false
set.I've tried different versions of aws provider, and the bug has been reproduced in the latest provider version.
The text was updated successfully, but these errors were encountered: