-
-
Notifications
You must be signed in to change notification settings - Fork 72
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
Fix variable enabled=false results in errors #47
Conversation
* Add local availability_zones which is empty if disabled * private_count and public_count are either 0 if disabled or the length of the local.availability_zones list * therefore aws resource counts will not reference empty list in element function * also guaranteed to have same number of elements in zipmap function * Added convenience local lists of tuples for outputs * Note az_ngw_ids is now an empty map if disabled - previously a map of constant "0" * dummy_az_ngw_ids is no longer referenced so remove * Transform local lists of tuples to output maps * since private_count and public_count are not both >0, no ellipsis needed in transform, producing single map value * output maps are all empty if disabled
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for this, and thank you especially for adding tests.
We can accept this as is, but if you have the energy, I would appreciate it if you would please help bring this module up to our current standards.
UPDATE: I know this is asking a lot, really too much. I will take care of it for you.
Update the label
modules and usage:
- Replace
module.this.enabled
withlocal.enabled
everywhere - Update labels to version 0.24.1
- Replace old and unhelpful
attributes = compact(concat(var.attributes, ["public"]))
with
attributes = ["public"]
(and same for "private" label)
Also please run the following commands and check in the changes:
make init
make github/init
make pr/auto-format
For extra credit, merge #41 into this PR first.
main.tf
Outdated
public_enabled = module.this.enabled && var.type == "public" | ||
private_enabled = module.this.enabled && var.type == "private" | ||
availability_zones = (module.this.enabled) ? var.availability_zones : [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new style guide is
public_enabled = module.this.enabled && var.type == "public" | |
private_enabled = module.this.enabled && var.type == "private" | |
availability_zones = (module.this.enabled) ? var.availability_zones : [] | |
enabled = module.this.enabled | |
public_enabled = local.enabled && var.type == "public" | |
private_enabled = local.enabled && var.type == "private" | |
availability_zones = local.enabled ? var.availability_zones : [] |
/test all |
/test all |
Thank you for your review and merge @Nuru. |
what
why
references