Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up help for shortcuts. #3833

Open
yhakbar opened this issue Feb 3, 2025 · 0 comments
Open

Clean up help for shortcuts. #3833

yhakbar opened this issue Feb 3, 2025 · 0 comments
Labels
bug Something isn't working cli-redesign Issues related to the CLI Redesign preserved Preserved issues never go stale

Comments

@yhakbar
Copy link
Collaborator

yhakbar commented Feb 3, 2025

Blocked by #3723

We need to clean up the help for shortcuts:

$ terragrunt plan --help
Usage: tofu [global options] plan [options]

  Generates a speculative execution plan, showing what actions OpenTofu
  would take to apply the current configuration. This command will not
  actually perform the planned actions.

  You can optionally save the plan to a file, which you can then pass to
  the "apply" command to perform exactly the actions described in the plan.

Plan Customization Options:

  The following options customize how OpenTofu will produce its plan. You
  can also use these options when you run "tofu apply" without passing
  it a saved plan, in order to plan and apply in a single command.

  -destroy            Select the "destroy" planning mode, which creates a plan
                      to destroy all objects currently managed by this
                      OpenTofu configuration instead of the usual behavior.

  -refresh-only       Select the "refresh only" planning mode, which checks
                      whether remote objects still match the outcome of the
                      most recent OpenTofu apply but does not propose any
                      actions to undo any changes made outside of OpenTofu.

  -refresh=false      Skip checking for external changes to remote objects
                      while creating the plan. This can potentially make
                      planning faster, but at the expense of possibly planning
                      against a stale record of the remote system state.

  -replace=resource   Force replacement of a particular resource instance using
                      its resource address. If the plan would've normally
                      produced an update or no-op action for this instance,
                      OpenTofu will plan to replace it instead. You can use
                      this option multiple times to replace more than one object.

  -target=resource    Limit the planning operation to only the given module,
                      resource, or resource instance and all of its
                      dependencies. You can use this option multiple times to
                      include more than one object. This is for exceptional
                      use only.

  -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.

Other Options:

  -compact-warnings          If OpenTofu produces any warnings that are not
                             accompanied by errors, shows them in a more compact
                             form that includes only the summary messages.

  -detailed-exitcode         Return detailed exit codes when the command exits.
                             This will change the meaning of exit codes to:
                             0 - Succeeded, diff is empty (no changes)
                             1 - Errored
                             2 - Succeeded, there is a diff

  -generate-config-out=path  (Experimental) If import blocks are present in
                             configuration, instructs OpenTofu to generate HCL
                             for any imported resources not already present. The
                             configuration is written to a new file at PATH,
                             which must not already exist. OpenTofu may still
                             attempt to write configuration if the plan errors.

  -input=true                Ask for input for variables if not directly set.

  -lock=false                Don't hold a state lock during the operation. This
                             is dangerous if others might concurrently run
                             commands against the same workspace.

  -lock-timeout=0s           Duration to retry a state lock.

  -no-color                  If specified, output won't contain any color.

  -concise                   Displays plan output in a concise way, skipping the
                                                         refreshing log lines.

  -out=path                  Write a plan file to the given path. This can be
                             used as input to the "apply" command.

  -parallelism=n             Limit the number of concurrent operations. Defaults
                             to 10.

  -state=statefile           A legacy option used for the local backend only.
                             See the local backend's documentation for more
                             information.

$  terragrunt run --help
Usage: terragrunt run [options] -- <tofu/terraform command>

   Run a command, passing arguments to an orchestrated tofu/terraform binary.

   This is the explicit, and most flexible form of running an IaC command with Terragrunt. Shortcuts can be found in "terragrunt --help" for common use-cases.

Examples:
   # Run a plan
   terragrunt run -- plan
   # Shortcut:
   # terragrunt plan

   # Run output with -json flag
   terragrunt run -- output -json
   # Shortcut:
   # terragrunt output -json

   # Run a plan against a Stack of configurations in the current directory
   terragrunt run --all -- plan

Options:
   --all                                       Run the specified OpenTofu/Terraform command on the stack of units in the current directory. [$TG_ALL]
   --auth-provider-cmd value                   Run the provided command and arguments to authenticate Terragrunt dynamically when necessary. [$TG_AUTH_PROVIDER_CMD]
   --backend-require-bootstrap                 When this flag is set Terragrunt will fail if the remote state bucket needs to be created. [$TG_BACKEND_REQUIRE_BOOTSTRAP]
   --config value                              The path to the Terragrunt config file. Default is terragrunt.hcl. [$TG_CONFIG]
   --dependency-fetch-output-from-state        The option fetches dependency output directly from the state file instead of using tofu/terraform output. [$TG_DEPENDENCY_FETCH_OUTPUT_FROM_STATE]
   --disable-bucket-update                     When this flag is set Terragrunt will not update the remote state bucket. [$TG_DISABLE_BUCKET_UPDATE]
   --disable-command-validation                When this flag is set, Terragrunt will not validate the tofu/terraform command. [$TG_DISABLE_COMMAND_VALIDATION]
   --download-dir value                        The path to download OpenTofu/Terraform modules into. Default is .terragrunt-cache in the working directory. [$TG_DOWNLOAD_DIR]
   --engine-cache-path value                   Cache path for Terragrunt engine files. [$TG_ENGINE_CACHE_PATH]
   --engine-log-level value                    Terragrunt engine log level. [$TG_ENGINE_LOG_LEVEL]
   --engine-skip-check                         Skip checksum check for Terragrunt engine files. [$TG_ENGINE_SKIP_CHECK]
   --experimental-engine                       Enable Terragrunt experimental engine. [$TG_EXPERIMENTAL_ENGINE]
   --feature value                             Set feature flags for the HCL code. [$TG_FEATURE]
   --graph                                     Run the specified OpenTofu/Terraform command following the Directed Acyclic Graph (DAG) of dependencies. [$TG_GRAPH]
   --iam-assume-role value                     Assume the specified IAM role before executing OpenTofu/Terraform. [$TG_IAM_ASSUME_ROLE]
   --iam-assume-role-duration value            Session duration for IAM Assume Role session. [$TG_IAM_ASSUME_ROLE_DURATION]
   --iam-assume-role-session-name value        Name for the IAM Assumed Role session. [$TG_IAM_ASSUME_ROLE_SESSION_NAME]
   --iam-assume-role-web-identity-token value  For AssumeRoleWithWebIdentity, the WebIdentity token. [$TG_IAM_ASSUME_ROLE_WEB_IDENTITY_TOKEN]
   --inputs-debug                              Write debug.tfvars to working folder to help root-cause issues. [$TG_INPUTS_DEBUG]
   --no-auto-approve                           Don't automatically append '-auto-approve' to the underlying OpenTofu/Terraform commands run with 'run-all'. [$TG_NO_AUTO_APPROVE]
   --no-auto-init                              Don't automatically run 'terraform/tofu init' during other terragrunt commands. You must run 'terragrunt init' manually. [$TG_NO_AUTO_INIT]
   --no-auto-retry                             Don't automatically re-run command in case of transient errors. [$TG_NO_AUTO_RETRY]
   --no-destroy-dependencies-check             When this flag is set, Terragrunt will not check for dependent units when destroying. [$TG_NO_DESTROY_DEPENDENCIES_CHECK]
   --parallelism value                         Parallelism for --all commands. [$TG_PARALLELISM]
   --provider-cache                            Enables Terragrunt's provider caching. [$TG_PROVIDER_CACHE]
   --provider-cache-dir value                  The path to the Terragrunt provider cache directory. By default, 'terragrunt/providers' folder in the user cache directory. [$TG_PROVIDER_CACHE_DIR]
   --provider-cache-hostname value             The hostname of the Terragrunt Provider Cache server. By default, 'localhost'. [$TG_PROVIDER_CACHE_HOSTNAME]
   --provider-cache-port value                 The port of the Terragrunt Provider Cache server. By default, assigned automatically. [$TG_PROVIDER_CACHE_PORT]
   --provider-cache-registry-names value       The list of remote registries to cached by Terragrunt Provider Cache server. By default, 'registry.terraform.io', 'registry.opentofu.org'. [$TG_PROVIDER_CACHE_REGISTRY_NAMES]
   --provider-cache-token value                The token for authentication to the Terragrunt Provider Cache server. By default, assigned automatically. [$TG_PROVIDER_CACHE_TOKEN]
   --queue-exclude-dir value                   Unix-style glob of directories to exclude from the queue of Units to run. [$TG_QUEUE_EXCLUDE_DIR]
   --queue-exclude-external                    Ignore external dependencies for --all commands. [$TG_QUEUE_EXCLUDE_EXTERNAL]
   --queue-excludes-file value                 Path to a file with a list of directories that need to be excluded when running *-all commands. [$TG_QUEUE_EXCLUDES_FILE]
   --queue-ignore-dag-order                    Ignore DAG order for --all commands. [$TG_QUEUE_IGNORE_DAG_ORDER]
   --queue-ignore-errors                       Continue processing Units even if a dependency fails. [$TG_QUEUE_IGNORE_ERRORS]
   --queue-include-dir value                   Unix-style glob of directories to include from the queue of Units to run. [$TG_QUEUE_INCLUDE_DIR]
   --queue-include-external                    Include external dependencies for --all commands without asking. [$TG_QUEUE_INCLUDE_EXTERNAL]
   --queue-include-units-reading value         If flag is set, 'run-all' will only run the command against Terragrunt units that read the specified file via an HCL function or include. [$TG_QUEUE_INCLUDE_UNITS_READING]
   --queue-strict-include                      If flag is set, only modules under the directories passed in with '--include-dir' will be included. [$TG_QUEUE_STRICT_INCLUDE]
   --source value                              Download OpenTofu/Terraform configurations from the specified source into a temporary folder, and run Terraform in that temporary folder. [$TG_SOURCE]
   --source-map value                          Replace any source URL (including the source URL of a config pulled in with dependency blocks) that has root source with dest. [$TG_SOURCE_MAP]
   --source-update                             Delete the contents of the temporary folder to clear out any old, cached source code before downloading new source code into it. [$TG_SOURCE_UPDATE]
   --tf-forward-stdout                         If specified, the output of OpenTofu/Terraform commands will be printed as is, without being integrated into the Terragrunt log. [$TG_TF_FORWARD_STDOUT]
   --tf-path value                             Path to the OpenTofu/Terraform binary. Default is tofu (on PATH). [$TG_TF_PATH]
   --units-that-include value                  If flag is set, 'run-all' will only run the command against Terragrunt modules that include the specified file. [$TG_UNITS_THAT_INCLUDE]
   --use-partial-parse-config-cache            Enables caching of includes during partial parsing operations. Will also be used for the --iam-role option if provided. [$TG_USE_PARTIAL_PARSE_CONFIG_CACHE]

Global Options:
   --experiment value         Enables specific experiments. For a list of available experiments, see https://terragrunt.gruntwork.io/docs/reference/experiment-mode . [$TG_EXPERIMENT]
   --experiment-mode          Enables experiment mode for Terragrunt. For more information, see https://terragrunt.gruntwork.io/docs/reference/experiment-mode . [$TG_EXPERIMENT_MODE]
   --log-custom-format value  Set the custom log formatting. [$TG_LOG_CUSTOM_FORMAT]
   --log-disable              Disable logging. [$TG_LOG_DISABLE]
   --log-format value         Set the log format. [$TG_LOG_FORMAT]
   --log-level value          Sets the logging level for Terragrunt. Supported levels: stderr, stdout, error, warn, info, debug, trace. (default: info) [$TG_LOG_LEVEL]
   --log-show-abs-paths       Show absolute paths in logs. (default: false) [$TG_LOG_SHOW_ABS_PATHS]
   --no-color                 Disable color output. [$TG_NO_COLOR]
   --non-interactive          Assume "yes" for all prompts. (default: false) [$TG_NON_INTERACTIVE]
   --strict-control value     Enables specific strict controls. For a list of available controls, run 'terragrunt info strict'. [$TG_STRICT_CONTROL]
   --strict-mode              Enables strict mode for Terragrunt. For more information, run 'terragrunt info strict'. [$TG_STRICT_MODE]
   --working-dir value        The path to the directory of Terragrunt configurations. Default is current directory. [$TG_WORKING_DIR]
   --help, -h                 Show help.
   --version, -v              Show terragrunt version.

$ terragrunt plan --provider-cache --experiment cli-redesign
10:16:54.578 INFO   Terragrunt Cache server is listening on 127.0.0.1:51049
10:16:54.578 INFO   Start Terragrunt Cache server
10:16:54.878 INFO   Caching terraform providers for .
10:16:54.917 INFO   tofu: Initializing the backend...
10:16:54.918 INFO   tofu: Initializing provider plugins...
10:16:54.918 INFO   tofu: OpenTofu has been successfully initialized!
10:16:54.918 INFO   tofu:
10:16:54.918 INFO   tofu: You may now begin working with OpenTofu. Try running "tofu plan" to see
10:16:54.918 INFO   tofu: any changes that are required for your infrastructure. All OpenTofu commands
10:16:54.918 INFO   tofu: should now work.
10:16:54.918 INFO   tofu: If you ever set or change modules or backend configuration for OpenTofu,
10:16:54.918 INFO   tofu: rerun this command to reinitialize your working directory. If you forget, other
10:16:54.918 INFO   tofu: commands will detect it and remind you to do so if necessary.
10:16:54.940 INFO   tofu: Initializing the backend...
10:16:54.940 INFO   tofu: Initializing provider plugins...
10:16:54.940 INFO   tofu: OpenTofu has been successfully initialized!
10:16:54.940 INFO   tofu:
10:16:54.940 INFO   tofu: You may now begin working with OpenTofu. Try running "tofu plan" to see
10:16:54.940 INFO   tofu: any changes that are required for your infrastructure. All OpenTofu commands
10:16:54.940 INFO   tofu: should now work.
10:16:54.940 INFO   tofu: If you ever set or change modules or backend configuration for OpenTofu,
10:16:54.940 INFO   tofu: rerun this command to reinitialize your working directory. If you forget, other
10:16:54.940 INFO   tofu: commands will detect it and remind you to do so if necessary.
10:16:54.960 STDOUT tofu: No changes. Your infrastructure matches the configuration.
10:16:54.960 STDOUT tofu: OpenTofu has compared your real infrastructure against your configuration and
10:16:54.960 STDOUT tofu: found no differences, so no changes are needed.
10:16:54.960 INFO   Shutting down Terragrunt Cache server...
10:16:54.961 INFO   Terragrunt Cache server stopped

You only know about those run flags if you are using the run command, but they work in the shortcuts like plan as well. We should add some preamble, like in the RFC to make it clear that users have access to all the same capabilities that they do when using the run command.

Please don't address this now, as it doesn't need to block merging the PR. Adding an issue to address later.

Originally posted by @yhakbar in #3723 (comment)

@yhakbar yhakbar added bug Something isn't working preserved Preserved issues never go stale cli-redesign Issues related to the CLI Redesign labels Feb 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cli-redesign Issues related to the CLI Redesign preserved Preserved issues never go stale
Projects
None yet
Development

No branches or pull requests

1 participant