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

Fix named ranges behaviour if cidr_tpl_file variable not provided. #2005

Conversation

miromichalicka
Copy link
Contributor

Issue: If factories_config.cidr_tpl_file variable wasn't provided, the code failed.

│ Error: Invalid function argument
│ 
│   on .terraform/modules/internal_firewall/modules/net-vpc-firewall/main.tf line 50, in locals:
│   50:     can(var.factories_config.cidr_tpl_file) ? yamldecode(file(var.factories_config.cidr_tpl_file)) : {},
│     ├────────────────
│     │ while calling file(path)
│     │ var.factories_config.cidr_tpl_file is null
│ 
│ Invalid value for "path" parameter: argument must not be null.

Solution: Validate if the variable isn't null (variable's default value) and only then proceed to load the file.


Checklist

I applicable, I acknowledge that I have:

  • Read the contributing guide
  • Ran terraform fmt on all modified files
  • Regenerated the relevant README.md files using tools/tfdoc.py
  • Made sure all relevant tests pass

modules/net-vpc-firewall/main.tf Show resolved Hide resolved
modules/net-vpc-firewall/README.md Outdated Show resolved Hide resolved
@juliocc juliocc enabled auto-merge (squash) January 24, 2024 11:03
@juliocc juliocc merged commit 15439c3 into GoogleCloudPlatform:master Jan 24, 2024
9 checks passed
@miromichalicka miromichalicka deleted the miromichalicka/fix-cidr-file-loading-net-fwr-module branch January 24, 2024 12:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants