opentofu/internal/command/testdata
Martin Atkins 6a27c82bb4 tofu show: -module=DIR mode, for showing just a single module
We previously added the -config mode for showing the entire assembled
configuration tree, including the content of any descendent modules, but
that mode requires first running "tofu init" to install all of the
provider and module dependencies of the configuration.

This new -module=DIR mode returns a subset of the same JSON representation
for only a single module that can be generated without first installing
any dependencies, making this mode more appropriate for situations like
generating documentation for a single module when importing it into the
OpenTofu Registry. The registry generation process does not want to endure
the overhead of installing other providers and modules when all it actually
needs is metadata about the top-level declarations in the module.

To minimize the risk to the already-working full-config JSON representation
while still reusing most of its code, the implementation details of package
jsonconfig are a little awkward here. Since this code changes relatively
infrequently and is implementing an external interface subject to
compatibility constraints, and since this new behavior is relatively
marginal and intended primarily for our own OpenTofu Registry purposes,
this is a pragmatic tradeoff that is hopefully compensated for well enough
by the code comments that aim to explain what's going on for the benefit
of future maintainers. If we _do_ find ourselves making substantial changes
to this code at a later date then we can consider a more significant
restructure of the code at that point; the weird stuff is intentionally
encapsulated inside package jsonconfig so it can change later without
changing any callers.

Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
2025-07-10 13:18:26 -07:00
..
apply fix: remove elapsed_seconds check on the golden reference (#2565) 2025-03-06 09:03:46 -03:00
apply-config-invalid Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
apply-destroy-targeted Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
apply-error Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
apply-excluded Add exclude flag support (#1900) 2024-11-05 10:16:00 -05:00
apply-input Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
apply-input-partial Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
apply-plan-conditional-sensitive add e2e test to cover the panic case of unknown conditional with sensitive (#661) 2023-10-05 15:04:51 +03:00
apply-plan-no-module Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
apply-replace Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
apply-sensitive-output Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
apply-shutdown Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
apply-targeted Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
apply-tf-workspace feat: Add support for tofu.workspace which will be resolved in the same way as terraform.workspace (#1305) 2024-08-01 08:14:34 -04:00
apply-tofu-workspace feat: Add support for tofu.workspace which will be resolved in the same way as terraform.workspace (#1305) 2024-08-01 08:14:34 -04:00
apply-vars Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
apply_cbd_with_refresh_false fix: unused config's create_before_destroy on resource change with no refresh (#2248) 2024-12-20 10:47:00 +02:00
backend-change Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
backend-change-multi-default-to-single Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
backend-change-multi-to-multi Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
backend-change-multi-to-no-default-with-default Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
backend-change-multi-to-no-default-without-default Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
backend-change-multi-to-single Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
backend-change-single-to-single Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
backend-changed-with-legacy Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
backend-from-state Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
backend-inmem-locked Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
backend-new Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
backend-new-interp Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
backend-new-legacy Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
backend-new-migrate Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
backend-new-migrate-existing Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
backend-plan-backend-empty Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
backend-plan-backend-empty-config Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
backend-plan-backend-match Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
backend-plan-backend-mismatch Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
backend-plan-legacy Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
backend-plan-legacy-data Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
backend-plan-local Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
backend-plan-local-match Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
backend-plan-local-mismatch-lineage Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
backend-plan-local-newer Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
backend-unchanged Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
backend-unchanged-vars Fix regression of backend reinit detection when backend schema has required arguments (#2119) 2024-11-04 14:23:32 -05:00
backend-unchanged-with-legacy Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
backend-unset Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
backend-unset-with-legacy Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
command-check-required-version cli: Make state commands check required version (#30511) 2022-03-31 13:42:42 -04:00
console-multiline-vars Adds multi line support to console (#1875) 2024-08-02 10:21:44 +01:00
empty Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
fmt Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
get Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
graph Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
import-missing-resource-config Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
import-module-input-variable Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
import-module-var-file Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
import-provider Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
import-provider-aliased Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
import-provider-datasource Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
import-provider-implicit Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
import-provider-invalid Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
import-provider-remote-state Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
import-provider-var Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
import-provider-var-default Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
import-provider-var-file Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
init Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
init-backend Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
init-backend-config-file Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
init-backend-config-file-change Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
init-backend-config-file-change-migrate-existing Test case for changing backend hash during aborted state migration 2021-11-02 10:20:37 -05:00
init-backend-config-kv Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
init-backend-empty Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
init-backend-http Error if backup or backup-out options are used without the state option on non-local backends for the state mv command 2021-11-09 13:09:36 -06:00
init-backend-migrate-while-locked cli: Restore -lock and -lock-timeout init flags 2021-10-19 09:32:30 -04:00
init-backend-selected-workspace-doesnt-exist-multi command: Auto-select single workspace if necessary 2021-09-22 16:03:11 -05:00
init-backend-selected-workspace-doesnt-exist-single command: Auto-select single workspace if necessary 2021-09-22 16:03:11 -05:00
init-check-required-version Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
init-check-required-version-first make sure required_version is checked before diags 2021-09-28 13:30:03 -04:00
init-check-required-version-first-module LoadModule now always returns the module 2021-09-28 17:58:40 -04:00
init-cloud-simple command/init: Be explicit that some options are not relevant for Cloud 2021-11-17 14:20:44 -08:00
init-encryption-available Skip reading encryption keys on tofu init with -backend=false flag set (#2293) 2024-12-20 10:45:12 +02:00
init-get Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
init-get-provider-detected-duplicate Add a warning when multiple likely forks of a provider are detected (#1009) 2023-12-14 12:21:16 -05:00
init-get-provider-detected-legacy Another batch of minor typos (#1953) 2024-09-09 07:51:39 -04:00
init-get-provider-invalid-package Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
init-get-provider-legacy-from-state Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
init-get-provider-source Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
init-get-providers Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
init-internal Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
init-internal-invalid Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
init-legacy-rc Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
init-module-early-eval command: Improve reliability of module install cancel tests 2025-04-18 09:11:22 -07:00
init-module-variable-source Static Evaluation Base, Module Sources, Backend Config (#1718) 2024-06-24 09:13:07 -04:00
init-module-variable-source-multiple Adds prompt for missing static variables (#2047) 2024-10-07 18:30:42 +01:00
init-module-variable-version Static Evaluation Base, Module Sources, Backend Config (#1718) 2024-06-24 09:13:07 -04:00
init-provider-lock-file Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
init-provider-lock-file-readonly-add Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
init-provider-now-unused Revert "Fixes #898: Replace hashicorp and terraform references" (#995) 2023-12-11 15:10:03 -05:00
init-providers-lock Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
init-required-providers Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
init-syntax-invalid-backend-attribute-invalid Make config errors more important during init operations (#33628) 2023-08-09 11:19:00 +02:00
init-syntax-invalid-backend-invalid add tests for init syntax error handling 2023-02-15 21:01:27 -08:00
init-syntax-invalid-extra-label Fix repetitive diagnosis output in init response (#1890) 2024-09-05 07:36:18 -04:00
init-syntax-invalid-no-backend add tests for init syntax error handling 2023-02-15 21:01:27 -08:00
init-syntax-invalid-with-backend add tests for init syntax error handling 2023-02-15 21:01:27 -08:00
init-with-tests testing framework: change test file extension to .tftest.hcl (#33553) 2023-07-20 16:57:05 +02:00
init-with-tests-with-module testing framework: change test file extension to .tftest.hcl (#33553) 2023-07-20 16:57:05 +02:00
init-with-tests-with-provider Revert "Fixes #898: Replace hashicorp and terraform references" (#995) 2023-12-11 15:10:03 -05:00
inmem-backend Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
login-oauth-server Rename terraform to tofu in GoString method and docstrings (#576) 2023-09-26 19:09:27 +02:00
login-tfe-server Remove all Terraform Cloud mentions in STDOUTs in the codebase (#703) 2023-10-12 12:07:16 +01:00
modules Revert "Fixes #898: Replace hashicorp and terraform references" (#995) 2023-12-11 15:10:03 -05:00
parallelism Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
plan Add count of forgotten resources to plan and apply outputs. (#2010) 2025-02-24 14:53:32 -05:00
plan-emptydiff Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
plan-existing-state Revert "Fixes #898: Replace hashicorp and terraform references" (#995) 2023-12-11 15:10:03 -05:00
plan-fail-condition add command test for errored plan 2022-12-14 16:23:31 -05:00
plan-import-config-gen Rename multiple packages to OpenTofu (depsfile, genconfig, getmodules) (#499) 2023-09-20 17:05:24 +03:00
plan-invalid Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
plan-invalid-reference-try jsonformat: Tolerate incorrect paths in plan relevant_attributes 2025-07-03 08:50:12 -07:00
plan-no-test-vars test: ensure test vars are not used in tf plan (#2128) 2024-11-12 17:23:54 +02:00
plan-out-backend Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
plan-out-backend-legacy Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
plan-provider-input terraform: use hcl.MergeBodies instead of configs.MergeBodies for pro… (#29000) 2021-06-25 08:48:47 -04:00
plan-replace Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
plan-sensitive-output Add -show-sensitive flag to tofu plan, apply, state-show and output commands (#1554) 2024-07-22 10:58:57 +01:00
plan-vars Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
plan-vars-unset Adds prompt for missing static variables (#2047) 2024-10-07 18:30:42 +01:00
providers Revert "Fixes #898: Replace hashicorp and terraform references" (#995) 2023-12-11 15:10:03 -05:00
providers-lock Revert "Fixes #898: Replace hashicorp and terraform references" (#995) 2023-12-11 15:10:03 -05:00
providers-schema Adds provider function to tofu scheme/metadata commands (#1753) 2024-07-01 16:41:27 +01:00
push Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
push-backend-new Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
push-input Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
push-input-partial Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
push-no-remote Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
push-no-upload Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
push-tfvars Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
refresh Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
refresh-empty Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
refresh-output Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
refresh-targeted Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
refresh-unset-var Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
refresh-var Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
show Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
show-config-module command: tofu show -config (#2820) 2025-06-02 10:15:46 -07:00
show-config-single-module tofu show: -module=DIR mode, for showing just a single module 2025-07-10 13:18:26 -07:00
show-corrupt-statefile command: fix panic on show when state file is invalid or unavailable (#31444) 2022-07-15 17:31:56 +01:00
show-json Fix typos (#1905) 2024-08-29 13:20:33 -04:00
show-json-sensitive Improve comparison of sensitive marks on resources, and propagate the sensitive_attributes correctly (#1640) 2024-07-09 08:42:02 -04:00
show-json-state Revert "Fixes #898: Replace hashicorp and terraform references" (#995) 2023-12-11 15:10:03 -05:00
state-list-backend-custom Use registry.opentofu.org as the default registry (#379) 2023-10-03 10:49:38 +03:00
state-list-backend-default Use registry.opentofu.org as the default registry (#379) 2023-10-03 10:49:38 +03:00
state-list-nested-modules Revert "Fixes #898: Replace hashicorp and terraform references" (#995) 2023-12-11 15:10:03 -05:00
state-pull-backend Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
state-push-bad-lineage Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
state-push-good Write state using compact JSON representation (#1647) 2024-05-21 15:04:10 -04:00
state-push-replace-match Write state using compact JSON representation (#1647) 2024-05-21 15:04:10 -04:00
state-push-serial-newer Use registry.opentofu.org as the default registry (#379) 2023-10-03 10:49:38 +03:00
state-push-serial-older Write state using compact JSON representation (#1647) 2024-05-21 15:04:10 -04:00
test Fix: Allow function calls in test variable blocks (#2947) (#2990) 2025-07-08 08:26:25 -04:00
tftest-fmt test framework: add support for testing files to fmt command (#33576) 2023-07-26 10:38:47 +02:00
validate-invalid Fix typos (#1905) 2024-08-29 13:20:33 -04:00
validate-valid json-output: Release format version 1.0 2021-10-06 11:13:06 -04:00
variables Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
empty-file Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
statelocker.go statemgr+remote: context.Context parameters 2025-07-10 08:11:39 -07:00