Closed mildwonkey closed 5 years ago
@apparentlymart : I looked into making the same change in load_legacy.go, but from the looks of this (below) it will fail if there's a module override, because it would register as a repeated module (unless merging the overrides happened elsewhere).
https://github.com/hashicorp/terraform-config-inspect/blob/master/tfconfig/load_legacy.go#L240-L242
I tried to make some sense out of the pre-v0.12 merge code but it's all pretty opaque so I'm not sure really what the behavior was before... but I think you're right that as currently implemented here it would fail.
Ideally it'd behave the same way, so if you can see a relatively-easy path to get there then it'd be nice to fix them both at once, but even if not I think it'd be worth merging this fix because this is the codepath Terraform Core will be using to analyze module dependencies in terraform init
once a configuration has been updated for (or originally written for) v0.12, and thus bugs here will effect ongoing use rather than just folks who are migrating.
If a module is overridden and the override does not include "source", use the originally-defined module source.
See also https://github.com/hashicorp/terraform/issues/20550