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

"list" function was deprecated in Terraform v0.12 and is no longer available #66

Closed
Nightbr opened this issue Apr 23, 2021 · 1 comment
Labels
bug πŸ› An issue with the system

Comments

@Nightbr
Copy link

Nightbr commented Apr 23, 2021

Hello,

thanks for all your Terraform modules πŸ‘Œ

Describe the Bug

Seems there is a change in come function Terraform handles. It was a warning but now if you upgrade to tf 0.15.0 it will throw an error.

β•·
β”‚ Error: Error in function call
β”‚ 
β”‚   on .terraform/modules/eks_workers.autoscale_group/main.tf line 14, in resource "aws_launch_template" "default":
β”‚   14:         for_each = flatten(list(lookup(block_device_mappings.value, "ebs", [])))
β”‚     β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚     β”‚ block_device_mappings.value will be known only after apply
β”‚ 
β”‚ Call to function "list" failed: the "list" function was deprecated in Terraform v0.12 and is no longer available; use tolist([ ... ]) syntax to write a literal list.

Expected Behavior

We should handle properly new terraform function such as tolist instead of legacy list function:

https://www.terraform.io/docs/language/functions/list.html

Steps to Reproduce

Steps to reproduce the behavior:

  1. Go to '...'
  2. Run '....'
  3. Enter '....'
  4. See error

Screenshots

image

Environment (please complete the following information):

  • OS: Linux Mint (ubuntu base)
  • Version terraform v0.15.0

Additional Context

Here my fix:
for_each = flatten(tolist([lookup(block_device_mappings.value, "ebs", [])]))

Seems to work so far.

Related cloudposse/terraform-aws-ec2-autoscale-group#64

Feel free to ask me anything to help tackle this πŸ‘Œ

@Nightbr Nightbr added the bug πŸ› An issue with the system label Apr 23, 2021
@Nuru
Copy link
Sponsor Contributor

Nuru commented Apr 30, 2021

Closed by #67

@Nuru Nuru closed this as completed Apr 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug πŸ› An issue with the system
Projects
None yet
Development

No branches or pull requests

2 participants