From ee75b40d14edc9baf05542a78ef014a24bcc2574 Mon Sep 17 00:00:00 2001 From: Christian Mesh Date: Thu, 11 Jul 2024 11:00:18 -0400 Subject: [PATCH] Update help text for static variable support (#1804) Signed-off-by: Christian Mesh --- internal/command/e2etest/static_plan_test.go | 4 +++ internal/command/get.go | 9 ++++++ internal/command/graph.go | 9 ++++++ internal/command/init.go | 9 ++++++ internal/command/output.go | 29 +++++++++++++------- internal/command/providers.go | 9 ++++++ internal/command/providers_lock.go | 9 ++++++ internal/command/providers_mirror.go | 9 ++++++ internal/command/providers_schema.go | 11 ++++++++ internal/command/show.go | 9 ++++++ internal/command/state_list.go | 9 ++++++ internal/command/state_mv.go | 9 ++++++ internal/command/state_pull.go | 10 +++++++ internal/command/state_push.go | 9 ++++++ internal/command/state_replace_provider.go | 9 ++++++ internal/command/state_rm.go | 9 ++++++ internal/command/state_show.go | 9 ++++++ internal/command/taint.go | 9 ++++++ internal/command/test.go | 9 ++++++ internal/command/unlock.go | 9 ++++++ internal/command/untaint.go | 9 ++++++ internal/command/validate.go | 9 ++++++ internal/command/workspace_delete.go | 9 ++++++ internal/command/workspace_list.go | 10 +++++++ internal/command/workspace_new.go | 9 ++++++ internal/command/workspace_select.go | 8 ++++++ 26 files changed, 242 insertions(+), 10 deletions(-) diff --git a/internal/command/e2etest/static_plan_test.go b/internal/command/e2etest/static_plan_test.go index 4a6753d457..f91b95ccd9 100644 --- a/internal/command/e2etest/static_plan_test.go +++ b/internal/command/e2etest/static_plan_test.go @@ -73,6 +73,10 @@ func TestStaticPlanVariables(t *testing.T) { // Apply plan without static variable (embedded) run("apply", planfile).Success() + // Show State + run("show", statePath).Failure().StderrContains(modErr) + run("show", stateVar, modVar, statePath).Success().Contains(`out = "placeholder"`) + // Force Unlock run("force-unlock", "ident").Failure().StderrContains(backendErr) run("force-unlock", stateVar, modVar, "ident").Failure().StderrContains("Local state cannot be unlocked by another process") diff --git a/internal/command/get.go b/internal/command/get.go index d1259a2ce0..506d65cfbd 100644 --- a/internal/command/get.go +++ b/internal/command/get.go @@ -98,6 +98,15 @@ Options: suitable for use in text editor integrations and other automated systems. Always disables color. + -var 'foo=bar' Set a value for one of the input variables in the root + module of the configuration. Use this option more than + once to set more than one variable. + + -var-file=filename Load variable values from the given file, in addition + to the default files terraform.tfvars and *.auto.tfvars. + Use this option more than once to include more than one + variables file. + ` return strings.TrimSpace(helpText) } diff --git a/internal/command/graph.go b/internal/command/graph.go index 3cad4ec6fc..efdb5db323 100644 --- a/internal/command/graph.go +++ b/internal/command/graph.go @@ -272,6 +272,15 @@ Options: -module-depth=n (deprecated) In prior versions of OpenTofu, specified the depth of modules to show in the output. + + -var 'foo=bar' Set a value for one of the input variables in the root + module of the configuration. Use this option more than + once to set more than one variable. + + -var-file=filename Load variable values from the given file, in addition + to the default files terraform.tfvars and *.auto.tfvars. + Use this option more than once to include more than one + variables file. ` return strings.TrimSpace(helpText) } diff --git a/internal/command/init.go b/internal/command/init.go index 3127235610..215281fc13 100644 --- a/internal/command/init.go +++ b/internal/command/init.go @@ -1250,6 +1250,15 @@ Options: suitable for use in text editor integrations and other automated systems. Always disables color. + -var 'foo=bar' Set a value for one of the input variables in the root + module of the configuration. Use this option more than + once to set more than one variable. + + -var-file=filename Load variable values from the given file, in addition + to the default files terraform.tfvars and *.auto.tfvars. + Use this option more than once to include more than one + variables file. + ` return strings.TrimSpace(helpText) } diff --git a/internal/command/output.go b/internal/command/output.go index cddfea77e7..0e0001671c 100644 --- a/internal/command/output.go +++ b/internal/command/output.go @@ -135,19 +135,28 @@ Usage: tofu [global options] output [options] [NAME] Options: - -state=path Path to the state file to read. Defaults to - "terraform.tfstate". Ignored when remote - state is used. + -state=path Path to the state file to read. Defaults to + "terraform.tfstate". Ignored when remote + state is used. - -no-color If specified, output won't contain any color. + -no-color If specified, output won't contain any color. - -json If specified, machine readable output will be - printed in JSON format. + -json If specified, machine readable output will be + printed in JSON format. - -raw For value types that can be automatically - converted to a string, will print the raw - string directly, rather than a human-oriented - representation of the value. + -raw For value types that can be automatically + converted to a string, will print the raw + string directly, rather than a human-oriented + representation of the value. + + -var 'foo=bar' Set a value for one of the input variables in the root + module of the configuration. Use this option more than + once to set more than one variable. + + -var-file=filename Load variable values from the given file, in addition + to the default files terraform.tfvars and *.auto.tfvars. + Use this option more than once to include more than one + variables file. ` return strings.TrimSpace(helpText) } diff --git a/internal/command/providers.go b/internal/command/providers.go index 85a8f9ba54..d171cd8401 100644 --- a/internal/command/providers.go +++ b/internal/command/providers.go @@ -200,4 +200,13 @@ Options: -test-directory=path Set the OpenTofu test directory, defaults to "tests". When set, the test command will search for test files in the current directory and in the one specified by the flag. + + -var 'foo=bar' Set a value for one of the input variables in the root + module of the configuration. Use this option more than + once to set more than one variable. + + -var-file=filename Load variable values from the given file, in addition + to the default files terraform.tfvars and *.auto.tfvars. + Use this option more than once to include more than one + variables file. ` diff --git a/internal/command/providers_lock.go b/internal/command/providers_lock.go index 7d152ced00..4ee3a3ecfa 100644 --- a/internal/command/providers_lock.go +++ b/internal/command/providers_lock.go @@ -404,6 +404,15 @@ Options: Linux operating system running on an AMD64 or x86_64 CPU. Each provider is available only for a limited set of target platforms. + + -var 'foo=bar' Set a value for one of the input variables in the root + module of the configuration. Use this option more than + once to set more than one variable. + + -var-file=filename Load variable values from the given file, in addition + to the default files terraform.tfvars and *.auto.tfvars. + Use this option more than once to include more than one + variables file. ` } diff --git a/internal/command/providers_mirror.go b/internal/command/providers_mirror.go index 058ac42221..8a0cf0b274 100644 --- a/internal/command/providers_mirror.go +++ b/internal/command/providers_mirror.go @@ -381,5 +381,14 @@ Options: Linux operating system running on an AMD64 or x86_64 CPU. Each provider is available only for a limited set of target platforms. + + -var 'foo=bar' Set a value for one of the input variables in the root + module of the configuration. Use this option more than + once to set more than one variable. + + -var-file=filename Load variable values from the given file, in addition + to the default files terraform.tfvars and *.auto.tfvars. + Use this option more than once to include more than one + variables file. ` } diff --git a/internal/command/providers_schema.go b/internal/command/providers_schema.go index 776a3999f1..88d8fbabba 100644 --- a/internal/command/providers_schema.go +++ b/internal/command/providers_schema.go @@ -140,4 +140,15 @@ Usage: tofu [global options] providers schema -json Prints out a json representation of the schemas for all providers used in the current configuration. + +Options: + + -var 'foo=bar' Set a value for one of the input variables in the root + module of the configuration. Use this option more than + once to set more than one variable. + + -var-file=filename Load variable values from the given file, in addition + to the default files terraform.tfvars and *.auto.tfvars. + Use this option more than once to include more than one + variables file. ` diff --git a/internal/command/show.go b/internal/command/show.go index 6bbcb78c42..460e581839 100644 --- a/internal/command/show.go +++ b/internal/command/show.go @@ -116,6 +116,15 @@ Options: -json If specified, output the OpenTofu plan or state in a machine-readable form. + -var 'foo=bar' Set a value for one of the input variables in the root + module of the configuration. Use this option more than + once to set more than one variable. + + -var-file=filename Load variable values from the given file, in addition + to the default files terraform.tfvars and *.auto.tfvars. + Use this option more than once to include more than one + variables file. + ` return strings.TrimSpace(helpText) } diff --git a/internal/command/state_list.go b/internal/command/state_list.go index 1ed3b0b7cc..f9a991fa1c 100644 --- a/internal/command/state_list.go +++ b/internal/command/state_list.go @@ -135,6 +135,15 @@ Options: resource types have an attribute named "id" whose value equals the given id string. + -var 'foo=bar' Set a value for one of the input variables in the root + module of the configuration. Use this option more than + once to set more than one variable. + + -var-file=filename Load variable values from the given file, in addition + to the default files terraform.tfvars and *.auto.tfvars. + Use this option more than once to include more than one + variables file. + ` return strings.TrimSpace(helpText) } diff --git a/internal/command/state_mv.go b/internal/command/state_mv.go index 950e63d575..10322a2075 100644 --- a/internal/command/state_mv.go +++ b/internal/command/state_mv.go @@ -560,6 +560,15 @@ Options: -ignore-remote-version A rare option used for the remote backend only. See the remote backend documentation for more information. + -var 'foo=bar' Set a value for one of the input variables in the root + module of the configuration. Use this option more than + once to set more than one variable. + + -var-file=filename Load variable values from the given file, in addition + to the default files terraform.tfvars and *.auto.tfvars. + Use this option more than once to include more than one + variables file. + -state, state-out, and -backup are legacy options supported for the local backend only. For more information, see the local backend's documentation. diff --git a/internal/command/state_pull.go b/internal/command/state_pull.go index d341ffe5d7..17f08b23c8 100644 --- a/internal/command/state_pull.go +++ b/internal/command/state_pull.go @@ -99,6 +99,16 @@ Usage: tofu [global options] state pull [options] The primary use of this is for state stored remotely. This command will still work with local state but is less useful for this. +Options: + + -var 'foo=bar' Set a value for one of the input variables in the root + module of the configuration. Use this option more than + once to set more than one variable. + + -var-file=filename Load variable values from the given file, in addition + to the default files terraform.tfvars and *.auto.tfvars. + Use this option more than once to include more than one + variables file. ` return strings.TrimSpace(helpText) } diff --git a/internal/command/state_push.go b/internal/command/state_push.go index 8fe1d224fe..9d456bf6e6 100644 --- a/internal/command/state_push.go +++ b/internal/command/state_push.go @@ -192,6 +192,15 @@ Options: -lock-timeout=0s Duration to retry a state lock. + -var 'foo=bar' Set a value for one of the input variables in the root + module of the configuration. Use this option more than + once to set more than one variable. + + -var-file=filename Load variable values from the given file, in addition + to the default files terraform.tfvars and *.auto.tfvars. + Use this option more than once to include more than one + variables file. + ` return strings.TrimSpace(helpText) } diff --git a/internal/command/state_replace_provider.go b/internal/command/state_replace_provider.go index 0641dafd07..a7cd6e41aa 100644 --- a/internal/command/state_replace_provider.go +++ b/internal/command/state_replace_provider.go @@ -224,6 +224,15 @@ Options: -ignore-remote-version A rare option used for the remote backend only. See the remote backend documentation for more information. + -var 'foo=bar' Set a value for one of the input variables in the root + module of the configuration. Use this option more than + once to set more than one variable. + + -var-file=filename Load variable values from the given file, in addition + to the default files terraform.tfvars and *.auto.tfvars. + Use this option more than once to include more than one + variables file. + -state, state-out, and -backup are legacy options supported for the local backend only. For more information, see the local backend's documentation. diff --git a/internal/command/state_rm.go b/internal/command/state_rm.go index 10c294345a..7b085f982c 100644 --- a/internal/command/state_rm.go +++ b/internal/command/state_rm.go @@ -204,6 +204,15 @@ Options: are incompatible. This may result in an unusable workspace, and should be used with extreme caution. + -var 'foo=bar' Set a value for one of the input variables in the root + module of the configuration. Use this option more than + once to set more than one variable. + + -var-file=filename Load variable values from the given file, in addition + to the default files terraform.tfvars and *.auto.tfvars. + Use this option more than once to include more than one + variables file. + ` return strings.TrimSpace(helpText) } diff --git a/internal/command/state_show.go b/internal/command/state_show.go index 5c466eb5bc..99a61b5027 100644 --- a/internal/command/state_show.go +++ b/internal/command/state_show.go @@ -209,6 +209,15 @@ Options: up OpenTofu-managed resources. By default it will use the state "terraform.tfstate" if it exists. + -var 'foo=bar' Set a value for one of the input variables in the root + module of the configuration. Use this option more than + once to set more than one variable. + + -var-file=filename Load variable values from the given file, in addition + to the default files terraform.tfvars and *.auto.tfvars. + Use this option more than once to include more than one + variables file. + ` return strings.TrimSpace(helpText) } diff --git a/internal/command/taint.go b/internal/command/taint.go index a6e8f39c75..52f8c2b199 100644 --- a/internal/command/taint.go +++ b/internal/command/taint.go @@ -241,6 +241,15 @@ Options: -ignore-remote-version A rare option used for the remote backend only. See the remote backend documentation for more information. + -var 'foo=bar' Set a value for one of the input variables in the root + module of the configuration. Use this option more than + once to set more than one variable. + + -var-file=filename Load variable values from the given file, in addition + to the default files terraform.tfvars and *.auto.tfvars. + Use this option more than once to include more than one + variables file. + -state, state-out, and -backup are legacy options supported for the local backend only. For more information, see the local backend's documentation. diff --git a/internal/command/test.go b/internal/command/test.go index 788d9da9c7..c37caaded2 100644 --- a/internal/command/test.go +++ b/internal/command/test.go @@ -82,6 +82,15 @@ Options: -verbose Print the plan or state for each test run block as it executes. + + -var 'foo=bar' Set a value for one of the input variables in the root + module of the configuration. Use this option more than + once to set more than one variable. + + -var-file=filename Load variable values from the given file, in addition + to the default files terraform.tfvars and *.auto.tfvars. + Use this option more than once to include more than one + variables file. ` return strings.TrimSpace(helpText) } diff --git a/internal/command/unlock.go b/internal/command/unlock.go index 4fbcc98d36..6dfa3285ae 100644 --- a/internal/command/unlock.go +++ b/internal/command/unlock.go @@ -145,6 +145,15 @@ Usage: tofu [global options] force-unlock LOCK_ID Options: -force Don't ask for input for unlock confirmation. + + -var 'foo=bar' Set a value for one of the input variables in the root + module of the configuration. Use this option more than + once to set more than one variable. + + -var-file=filename Load variable values from the given file, in addition + to the default files terraform.tfvars and *.auto.tfvars. + Use this option more than once to include more than one + variables file. ` return strings.TrimSpace(helpText) } diff --git a/internal/command/untaint.go b/internal/command/untaint.go index c951c917bf..3eefa2b427 100644 --- a/internal/command/untaint.go +++ b/internal/command/untaint.go @@ -233,6 +233,15 @@ Options: -ignore-remote-version A rare option used for the remote backend only. See the remote backend documentation for more information. + -var 'foo=bar' Set a value for one of the input variables in the root + module of the configuration. Use this option more than + once to set more than one variable. + + -var-file=filename Load variable values from the given file, in addition + to the default files terraform.tfvars and *.auto.tfvars. + Use this option more than once to include more than one + variables file. + -state, state-out, and -backup are legacy options supported for the local backend only. For more information, see the local backend's documentation. diff --git a/internal/command/validate.go b/internal/command/validate.go index 5159bbb77e..2ea3cebfff 100644 --- a/internal/command/validate.go +++ b/internal/command/validate.go @@ -207,6 +207,15 @@ Options: -test-directory=path Set the OpenTofu test directory, defaults to "tests". When set, the test command will search for test files in the current directory and in the one specified by the flag. + + -var 'foo=bar' Set a value for one of the input variables in the root + module of the configuration. Use this option more than + once to set more than one variable. + + -var-file=filename Load variable values from the given file, in addition + to the default files terraform.tfvars and *.auto.tfvars. + Use this option more than once to include more than one + variables file. ` return strings.TrimSpace(helpText) } diff --git a/internal/command/workspace_delete.go b/internal/command/workspace_delete.go index e35b336c88..343589969a 100644 --- a/internal/command/workspace_delete.go +++ b/internal/command/workspace_delete.go @@ -235,6 +235,15 @@ Options: -lock-timeout=0s Duration to retry a state lock. + -var 'foo=bar' Set a value for one of the input variables in the root + module of the configuration. Use this option more than + once to set more than one variable. + + -var-file=filename Load variable values from the given file, in addition + to the default files terraform.tfvars and *.auto.tfvars. + Use this option more than once to include more than one + variables file. + ` return strings.TrimSpace(helpText) } diff --git a/internal/command/workspace_list.go b/internal/command/workspace_list.go index 02aa8793b4..72ca723f06 100644 --- a/internal/command/workspace_list.go +++ b/internal/command/workspace_list.go @@ -109,6 +109,16 @@ Usage: tofu [global options] workspace list List OpenTofu workspaces. +Options: + + -var 'foo=bar' Set a value for one of the input variables in the root + module of the configuration. Use this option more than + once to set more than one variable. + + -var-file=filename Load variable values from the given file, in addition + to the default files terraform.tfvars and *.auto.tfvars. + Use this option more than once to include more than one + variables file. ` return strings.TrimSpace(helpText) } diff --git a/internal/command/workspace_new.go b/internal/command/workspace_new.go index 76558c9f2d..a654807a2c 100644 --- a/internal/command/workspace_new.go +++ b/internal/command/workspace_new.go @@ -210,6 +210,15 @@ Options: -state=path Copy an existing state file into the new workspace. + + -var 'foo=bar' Set a value for one of the input variables in the root + module of the configuration. Use this option more than + once to set more than one variable. + + -var-file=filename Load variable values from the given file, in addition + to the default files terraform.tfvars and *.auto.tfvars. + Use this option more than once to include more than one + variables file. ` return strings.TrimSpace(helpText) } diff --git a/internal/command/workspace_select.go b/internal/command/workspace_select.go index d354f87f20..576d1f47fa 100644 --- a/internal/command/workspace_select.go +++ b/internal/command/workspace_select.go @@ -169,6 +169,14 @@ Options: -or-create=false Create the OpenTofu workspace if it doesn't exist. + -var 'foo=bar' Set a value for one of the input variables in the root + module of the configuration. Use this option more than + once to set more than one variable. + + -var-file=filename Load variable values from the given file, in addition + to the default files terraform.tfvars and *.auto.tfvars. + Use this option more than once to include more than one + variables file. ` return strings.TrimSpace(helpText) }