opentofu/internal/command
Martin Atkins cbfeb0fdc8 jsonconfig: Additional details about input variables
The JSON object describing an input variable can now include two additional
properties:

- "type" provides a JSON representation of the variable's type constraint,
  if one is set. Omitted if either there is no constraint declared at all
  or if it's set to "any", which are equivalent and both mean that the
  type is completely unconstrained.

  This uses the standard cty representation of a type constraint, which
  matches how OpenTofu already describes types in the provider protocol,
  in state snapshots, and in saved plan files.
- "required" directly represents whether callers are required to provide
  a value for the variable. This is technically redundant since it is
  set to true unless "default" is also set, but this avoids the need for
  consuming software to reimplement this rule and potentially allows us to
  make this rule more complicated/subtle in future if needed.

For some reason the documentation about the JSON configuration
representation did not previously mention the "variables" property at all,
so this adds documentation for both the new properties and the pre-existing
properties.

Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
2025-07-11 09:25:30 -07:00
..
arguments tofu show: -module=DIR mode, for showing just a single module 2025-07-10 13:18:26 -07:00
cliconfig hcl2shim: Split out legacy subset 2025-07-10 08:13:25 -07:00
clistate statemgr+remote: context.Context parameters 2025-07-10 08:11:39 -07:00
e2etest command: Only shim dependency lock file for installation actions 2025-07-01 07:44:47 -07:00
format Warning and Error consolidation CLI options (#1894) 2024-09-23 07:31:06 -04:00
jsonchecks Update copyright notice (#1232) 2024-02-08 09:48:59 +00:00
jsonconfig jsonconfig: Additional details about input variables 2025-07-11 09:25:30 -07:00
jsonformat jsonformat: Tolerate incorrect paths in plan relevant_attributes 2025-07-03 08:50:12 -07:00
jsonfunction Fix linting in internal/command (#2798) 2025-05-15 07:39:11 -04:00
jsonplan docs: update JSON Output Format page (#2885) 2025-06-10 10:33:27 -04:00
jsonprovider Another batch of minor typos (#1953) 2024-09-09 07:51:39 -04:00
jsonstate add deprecation warnings support for terraform_remote_state (#2679) 2025-04-25 12:26:28 +03:00
testdata jsonconfig: Additional details about input variables 2025-07-11 09:25:30 -07:00
testing Adds support for run block outputs in the test provider block (#2543) 2025-03-18 12:29:37 +04:00
views tofu show: -module=DIR mode, for showing just a single module 2025-07-10 13:18:26 -07:00
webbrowser httpclient: Add OTel tracing automatically when needed (#2772) 2025-05-09 10:16:38 +01:00
workdir Fix linting in internal/command (#2798) 2025-05-15 07:39:11 -04:00
alias.go Add new CLI arg to control what warnings should be shown for deprecated outputs/variables (#2705) 2025-05-08 17:01:40 +03:00
apply.go Rename the CLI arg for deprecation outputs/variables (#2774) 2025-05-09 14:01:32 +03:00
apply_destroy_test.go Use modern helpers from Go's testing.T API (#2692) 2025-04-23 07:48:41 -04:00
apply_test.go statemgr+remote: context.Context parameters 2025-07-10 08:11:39 -07:00
autocomplete.go backend: Backend.Workspaces takes context.Context 2025-05-07 14:14:34 -07:00
autocomplete_test.go Fix linting in internal/command (#2798) 2025-05-15 07:39:11 -04:00
cli_ui.go Fix struct names (#1494) 2024-04-25 08:15:46 +02:00
cli_ui_test.go Update copyright notice (#1232) 2024-02-08 09:48:59 +00:00
command.go Better var file type detection (#1881) 2024-08-02 07:29:40 -04:00
command_test.go tofu: EvalContext expression evaluation takes context.Context (#2937) 2025-06-19 10:46:31 +01:00
console.go Add new CLI arg to control what warnings should be shown for deprecated outputs/variables (#2705) 2025-05-08 17:01:40 +03:00
console_interactive.go Fix exit command in console interactive mode (#2086) 2024-10-29 12:13:44 +02:00
console_interactive_test.go Use modern helpers from Go's testing.T API (#2692) 2025-04-23 07:48:41 -04:00
console_state.go Implement the first part of RFC 20250303-linter-policy (#2577) 2025-03-10 13:16:27 -04:00
console_state_test.go Adds multi line support to console (#1875) 2024-08-02 10:21:44 +01:00
console_test.go Use modern helpers from Go's testing.T API (#2692) 2025-04-23 07:48:41 -04:00
flag_kv.go Update copyright notice (#1232) 2024-02-08 09:48:59 +00:00
flag_kv_test.go Update copyright notice (#1232) 2024-02-08 09:48:59 +00:00
fmt.go Fix linting in internal/command (#2798) 2025-05-15 07:39:11 -04:00
fmt_test.go Use modern helpers from Go's testing.T API (#2692) 2025-04-23 07:48:41 -04:00
get.go Update help text for static variable support (#1804) 2024-07-11 11:00:18 -04:00
get_test.go httpclient: Add OTel tracing automatically when needed (#2772) 2025-05-09 10:16:38 +01:00
graph.go Add context propagation to Command Meta entrypoint methods (#2735) 2025-04-30 16:28:19 +01:00
graph_test.go Fix linting in internal/command (#2798) 2025-05-15 07:39:11 -04:00
helper.go Update copyright notice (#1232) 2024-02-08 09:48:59 +00:00
hook_module_install.go Update copyright notice (#1232) 2024-02-08 09:48:59 +00:00
import.go statemgr+remote: context.Context parameters 2025-07-10 08:11:39 -07:00
import_test.go Fix linting in internal/command (#2798) 2025-05-15 07:39:11 -04:00
init.go statemgr+remote: context.Context parameters 2025-07-10 08:11:39 -07:00
init_test.go statemgr+remote: context.Context parameters 2025-07-10 08:11:39 -07:00
login.go Adopt OpenTofu's own "svchost" module 2025-06-12 09:37:59 -07:00
login_test.go Adopt OpenTofu's own "svchost" module 2025-06-12 09:37:59 -07:00
logout.go Adopt OpenTofu's own "svchost" module 2025-06-12 09:37:59 -07:00
logout_test.go Adopt OpenTofu's own "svchost" module 2025-06-12 09:37:59 -07:00
meta.go Adopt OpenTofu's own "svchost" module 2025-06-12 09:37:59 -07:00
meta_backend.go statemgr+remote: context.Context parameters 2025-07-10 08:11:39 -07:00
meta_backend_migrate.go statemgr+remote: context.Context parameters 2025-07-10 08:11:39 -07:00
meta_backend_migrate_test.go Update copyright notice (#1232) 2024-02-08 09:48:59 +00:00
meta_backend_test.go statemgr+remote: context.Context parameters 2025-07-10 08:11:39 -07:00
meta_config.go registry+getproviders: Registry client policy centralized in main 2025-05-12 10:50:17 -07:00
meta_dependencies.go command: Only shim dependency lock file for installation actions 2025-07-01 07:44:47 -07:00
meta_encryption.go tofu: EvalContext expression evaluation takes context.Context (#2937) 2025-06-19 10:46:31 +01:00
meta_new.go Initial wiring of encryption through the command package (#1316) 2024-03-07 08:55:57 -05:00
meta_providers.go getproviders: context.Context for source constructor functions 2025-06-13 08:22:47 -07:00
meta_test.go Fix linting in internal/command (#2798) 2025-05-15 07:39:11 -04:00
meta_ui.go add automated copyright header check (#1696) 2024-06-03 16:49:36 +03:00
meta_vars.go Adds prompt for missing static variables (#2047) 2024-10-07 18:30:42 +01:00
meta_vars_test.go Use modern helpers from Go's testing.T API (#2692) 2025-04-23 07:48:41 -04:00
metadata_command.go Update copyright notice (#1232) 2024-02-08 09:48:59 +00:00
metadata_functions.go Integrate provider functions (#1439) 2024-04-10 08:04:08 -04:00
metadata_functions_test.go Update copyright notice (#1232) 2024-02-08 09:48:59 +00:00
output.go statemgr+remote: context.Context parameters 2025-07-10 08:11:39 -07:00
output_test.go add deprecation warnings support for terraform_remote_state (#2679) 2025-04-25 12:26:28 +03:00
plan.go Rename the CLI arg for deprecation outputs/variables (#2774) 2025-05-09 14:01:32 +03:00
plan_test.go jsonformat: Tolerate incorrect paths in plan relevant_attributes 2025-07-03 08:50:12 -07:00
plugins.go Update copyright notice (#1232) 2024-02-08 09:48:59 +00:00
plugins_test.go providers: Interface now requires context.Context arguments 2025-05-23 08:58:23 -07:00
providers.go statemgr+remote: context.Context parameters 2025-07-10 08:11:39 -07:00
providers_lock.go command: Only shim dependency lock file for installation actions 2025-07-01 07:44:47 -07:00
providers_lock_test.go Use modern helpers from Go's testing.T API (#2692) 2025-04-23 07:48:41 -04:00
providers_mirror.go command: Only shim dependency lock file for installation actions 2025-07-01 07:44:47 -07:00
providers_mirror_test.go Update copyright notice (#1232) 2024-02-08 09:48:59 +00:00
providers_schema.go core: tofu.Context.Schemas takes a context.Context 2025-05-08 07:13:19 -07:00
providers_schema_test.go Fix linting in internal/command (#2798) 2025-05-15 07:39:11 -04:00
providers_test.go Use modern helpers from Go's testing.T API (#2692) 2025-04-23 07:48:41 -04:00
push.go Update copyright notice (#1232) 2024-02-08 09:48:59 +00:00
refresh.go Add context propagation to Command Meta entrypoint methods (#2735) 2025-04-30 16:28:19 +01:00
refresh_test.go statemgr+remote: context.Context parameters 2025-07-10 08:11:39 -07:00
show.go tofu show: -module=DIR mode, for showing just a single module 2025-07-10 13:18:26 -07:00
show_test.go jsonconfig: Additional details about input variables 2025-07-11 09:25:30 -07:00
state_command.go Update copyright notice (#1232) 2024-02-08 09:48:59 +00:00
state_list.go statemgr+remote: context.Context parameters 2025-07-10 08:11:39 -07:00
state_list_test.go Use modern helpers from Go's testing.T API (#2692) 2025-04-23 07:48:41 -04:00
state_meta.go backend: Backend.StateMgr takes context.Context 2025-05-07 14:14:34 -07:00
state_mv.go statemgr+remote: context.Context parameters 2025-07-10 08:11:39 -07:00
state_mv_test.go Use modern helpers from Go's testing.T API (#2692) 2025-04-23 07:48:41 -04:00
state_pull.go statemgr+remote: context.Context parameters 2025-07-10 08:11:39 -07:00
state_pull_test.go Use modern helpers from Go's testing.T API (#2692) 2025-04-23 07:48:41 -04:00
state_push.go statemgr+remote: context.Context parameters 2025-07-10 08:11:39 -07:00
state_push_test.go statemgr+remote: context.Context parameters 2025-07-10 08:11:39 -07:00
state_replace_provider.go statemgr+remote: context.Context parameters 2025-07-10 08:11:39 -07:00
state_replace_provider_test.go Use modern helpers from Go's testing.T API (#2692) 2025-04-23 07:48:41 -04:00
state_rm.go statemgr+remote: context.Context parameters 2025-07-10 08:11:39 -07:00
state_rm_test.go Use modern helpers from Go's testing.T API (#2692) 2025-04-23 07:48:41 -04:00
state_show.go statemgr+remote: context.Context parameters 2025-07-10 08:11:39 -07:00
state_show_test.go Use modern helpers from Go's testing.T API (#2692) 2025-04-23 07:48:41 -04:00
state_test.go Add context propagation to Command Meta entrypoint methods (#2735) 2025-04-30 16:28:19 +01:00
taint.go statemgr+remote: context.Context parameters 2025-07-10 08:11:39 -07:00
taint_test.go Fix linting in internal/command (#2798) 2025-05-15 07:39:11 -04:00
test.go Fix: Allow function calls in test variable blocks (#2947) (#2990) 2025-07-08 08:26:25 -04:00
test_test.go Fix: Allow function calls in test variable blocks (#2947) (#2990) 2025-07-08 08:26:25 -04:00
ui_input.go Update copyright notice (#1232) 2024-02-08 09:48:59 +00:00
ui_input_test.go Update copyright notice (#1232) 2024-02-08 09:48:59 +00:00
unlock.go statemgr+remote: context.Context parameters 2025-07-10 08:11:39 -07:00
unlock_test.go Fix linting in internal/command (#2798) 2025-05-15 07:39:11 -04:00
untaint.go statemgr+remote: context.Context parameters 2025-07-10 08:11:39 -07:00
untaint_test.go Fix linting in internal/command (#2798) 2025-05-15 07:39:11 -04:00
validate.go Add context propagation to Command Meta entrypoint methods (#2735) 2025-04-30 16:28:19 +01:00
validate_test.go Use modern helpers from Go's testing.T API (#2692) 2025-04-23 07:48:41 -04:00
version.go Update copyright notice (#1232) 2024-02-08 09:48:59 +00:00
version_test.go [OpenTelemetry] Add traces to init command (#2665) 2025-04-25 12:40:48 +01:00
workspace_command.go Update copyright notice (#1232) 2024-02-08 09:48:59 +00:00
workspace_command_test.go statemgr+remote: context.Context parameters 2025-07-10 08:11:39 -07:00
workspace_delete.go statemgr+remote: context.Context parameters 2025-07-10 08:11:39 -07:00
workspace_list.go backend: Backend.Workspaces takes context.Context 2025-05-07 14:14:34 -07:00
workspace_new.go statemgr+remote: context.Context parameters 2025-07-10 08:11:39 -07:00
workspace_select.go backend: Backend.StateMgr takes context.Context 2025-05-07 14:14:34 -07:00
workspace_show.go Add context propagation to Command Meta entrypoint methods (#2735) 2025-04-30 16:28:19 +01:00