Loading...
Loading...
### Terraform Version ```shell Terraform v1.15.8 on darwin_arm64 ``` ### Terraform Configuration Files https://github.com/Qantas94Heavy/terraform-modules-cmd-bug ### Debug Output See debug output of `terraform modules -json` with different Terraform versions here: - [1.15.8](https://github.com/Qantas94Heavy/terraform-modules-cmd-bug/blob/fa76c89f71fd2fd810a3f91f08154a298e47abc3/debug-output-1.10.5.txt) (incorrect) - [1.11.0](https://github.com/Qantas94Heavy/terraform-modules-cmd-bug/blob/fa76c89f71fd2fd810a3f91f08154a298e47abc3/debug-output-1.10.5.txt) (incorrect) - [1.10.5](https://github.com/Qantas94Heavy/terraform-modules-cmd-bug/blob/fa76c89f71fd2fd810a3f91f08154a298e47abc3/debug-output-1.10.5.txt) (correct) ### Expected Behavior `terraform modules -json` should give me the ability to work out where the actual local module on disk is. Either using the 1.10.x behavior which shows the hierarchy, i.e.: ```json { "format_version": "1.0", "modules": [ { "key": "my_app", "source": "./modules/foo", "version": "" }, { "key": "my_app.something_random", "source": "../bar", "version": "" } ] } ``` Or keeping a flat structure but updating the `source` to based on the directory the root module lives in, e.g.: ```json { "format_version": "1.0", "modules": [ { "key": "my_app", "source": "./modules/foo", "version": "" }, { "key": "something_random", "source": "./modules/bar", "version": "" } ] } ``` Or the internal `Dir` field in `.terraform/modules/modules.json` could be exposed, though not sure if that's desirable. ### Actual Behavior For nested local modules, I have no way of finding the actual module location on disk based on `source`. Nor can I work out that `something_random` is defined within another module. ```json { "format_version": "1.0", "modules": [ { "key": "my_app", "source": "./modules/foo", "version": "" }, { "key": "something_random", "source": "../bar", "version": "" } ] } ``` ### Steps to Reproduce 1. `terraform init` 2. `terraform modules -json` ### Additional Context For context, I'd like to use this to detect which modules a particular Terraform workspace requires. This is used to work out which workspaces to run `terraform plan` on if the source code of a local module is changed in a PR. ### References _No response_ ### Generative AI / LLM assisted development? None
Click on a version to see all relevant bugs
Terraform Integration
Learn more about where this data comes from
BugZero Plan
Streamline upgrades with automated vendor bug scrubs
BugZero Prevent
Wish you caught this bug sooner? Get proactive today.