Bug fix when parsing submodule/example with missing attributes
What does this MR do and why?
Some terraform modules fails to be parsed because their submodules or examples are missing some fields. These fields can be resources or dependencies.
In this part, we aggregate the data of each submodule/example into the root module, and if one of the right-hand sides are nil
, an error will be raised:
arr = []
arr |= nil
# TypeError: no implicit conversion of nil into Array
So we need to substitute nil
with an empty array to avoid such error:
arr = []
arr |= nil || []
=> []
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
Before | After |
---|---|
How to set up and validate locally
Follow the same steps mentioned here except for step 2.
Instead of testing with a random module, you can use this modulemodule.zip, which has the same file structure that caused the described bug.
On master, the module will be published, but its metadata record won't be created in the database because of the bug this MR is fixing.
Related to #461620