🐛 Bug Fixes
Fix: fix incorrect conditional logic for dynamic blocks iterating on `var.ec2_tag_set` and `var.ec2_tag_filter` @StephenTan-TW (#13)
what
Original PR description:
In order to ensure that tagging is processed correctly, I have created a PR of working code.
For some reason, we need to disable conditionals for ec2_tag_filter variable and we need to set the following conditional for ec2_tag_set:var.ec2_tag_set == null ? [] : [var.ec2_tag_set]
Note that I have had to do a huge rebase when pulling the upstream code. No idea what is going on.
- Swap second and third arguments in ternary operator for
var.ec2_tag_set
andvar.ec2_tag_filter
, which are incorrectly supplying an empty list if their lengths are > 0. - Use
lookup
function in dynamic blocks in order to introduce more robustness.
why
- If
var.ec2_tag_set
andvar.ec2_tag_filter
are supplied as non-empty lists, theec2_tag_filter
blocks will not be populated, since the ternary operator will evaluate to empty lists, and hence the dynamic block will produce no such blocks.