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

Setting variable enabled=false results in errors #46

Closed
paulrob-100 opened this issue Apr 19, 2021 · 0 comments · Fixed by #47
Closed

Setting variable enabled=false results in errors #46

paulrob-100 opened this issue Apr 19, 2021 · 0 comments · Fixed by #47
Labels
bug 🐛 An issue with the system

Comments

@paulrob-100
Copy link
Contributor

paulrob-100 commented Apr 19, 2021

Describe the Bug

When using the context variable enabled and setting it to false, terraform plan produces many errors.

The outputs produce errors due to usage of coalescelist with empty tuples.

Also:-

Error: Error in function call

  on ../../private.tf line 98, in resource "aws_route" "default":
  98:   route_table_id = zipmap(
  99:     var.availability_zones,
 100:     matchkeys(
 101:       aws_route_table.private.*.id,
 102:       aws_route_table.private.*.tags.AZ,
 103:       var.availability_zones,
 104:     ),
 105:   )[element(keys(var.az_ngw_ids), count.index)]
    |----------------
    | aws_route_table.private is empty tuple
    | var.availability_zones is list of string with 3 elements

Expected Behavior

Terraform plan and terraform apply should handle the module disablement gracefully
All outputs should be empty

Steps to Reproduce

Steps to reproduce the behavior:

  1. Go to examples/complete/main.tf
  2. Add enabled = false to the public_subnets and private_subnets module input variables
  3. Run terraform plan
  4. See error

Screenshots

None necessary

Environment (please complete the following information):

Anything that will help us triage the bug will help. Here are some ideas:

  • OS: Linux
  • Version TF 14.7

Additional Context

None

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

Successfully merging a pull request may close this issue.

1 participant