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

Error when cache_behavior is not supplied #8

Closed
mgaydarovaxway opened this issue Nov 25, 2020 · 3 comments
Closed

Error when cache_behavior is not supplied #8

mgaydarovaxway opened this issue Nov 25, 2020 · 3 comments

Comments

@mgaydarovaxway
Copy link

The field "cache_behavior" which is documented as optional is actually required. If omitted the following error occurs:

Error: Iteration over null value

on .terraform/modules//main.tf line 94, in resource "aws_cloudfront_distribution" "this":
94: for_each = [for k, v in var.cache_behavior : v if k == "default"]
|----------------
| var.cache_behavior is null

A null value cannot be used as the collection in a 'for' expression.

Error: Iteration over null value

on .terraform/modules//main.tf line 137, in resource "aws_cloudfront_distribution" "this":
137: for_each = [for k, v in var.cache_behavior : v if k != "default"]
|----------------
| var.cache_behavior is null

A null value cannot be used as the collection in a 'for' expression.

@joeky888
Copy link

This is on the roadmap, see hashicorp/terraform-provider-aws#14373 .

@antonbabenko
Copy link
Member

default_cache_behavior is required if create_distribution is set to true.

You can also update the module version to v1.5.0 which has been just released where the ordering of cache behaviors has been fixed (ref #12).

Closing this issue.

@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

3 participants