Setting variable enabled=false results in errors
paulrob-100 opened this issue · 0 comments
paulrob-100 commented
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:
- Go to examples/complete/main.tf
- Add
enabled = false
to the public_subnets and private_subnets module input variables - Run
terraform plan
- 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