run opentofu-plan apply
Execute 'init'/'apply' against an OpenTofu plan service
Synopsis
Apply
This command will execute a tofu init
and a tofu apply
against an OpenTofu plan service and display the resulting state file,
stdout, stderr, and return code returned from OpenTofu as well as some additional execution time information.
Runtime variables typically called vars
by OpenTofu can be specified using the --set
flag. The --set
flag
takes in a key=value
syntax. Any variables passed in using --set
will be validated against the decorator if one was
defined during the service's creation.
To view helpful information about what inputs are accepted by a particular service, run this command with just the
service name and the --use
flag.
When running an OpenTofu service, one can specify a state file that will be referenced while executing the plan
using the --state
flag. The --state
flag accepts JSON written directly to the CLI as well as the path
to an existing state-file using the @
symbol. If a path is specified, the resulting state file will be written to this
path unless --state-out
is specified.
If you would like to specify a separate path for the resulting state file to be written to, you can use the --state-out
flag.
torero run opentofu-plan apply <service-name> [flags]
Examples
Simple Example
Run apply against an OpenTofu service.
>_ torero run opentofu-plan apply my-opentofu-service
Setting Arguments
Run an OpenTofu plan service called my-opentofu-service
that takes in an argument of interface
.
>_ torero run opentofu-plan apply my-opentofu-service \
--set interface=0/0/0
Specify A State File Directly In CLI
Run apply against an OpenTofu service and provide a state file's JSON directly within the CLI. OpenTofu will reference the provided state file during execution.
>_ torero run opentofu-plan apply my-opentofu-service \
--state '{"check_results":null,"outputs":{},"resources":[]}'
Specify A State File Using Its Path
Run apply against an OpenTofu service and provide a state file via a path to the file. OpenTofu will reference the provided state file during execution.
>_ torero run opentofu-plan apply my-opentofu-service \
--state @opentofu.tfstate
Specify A State File Using Its Path As Well As A State Out Location
Run apply against an OpenTofu service and provide a state file via a path to the file as well as a location to write the resulting state file.
>_ torero run opentofu-plan apply my-opentofu-service \
--state @opentofu.tfstate \
--state-out @resultingstate.tfstate
Options
-h, --help help for apply
--set stringArray Sets an input argument to be passed into the script via the CLI when executed.
Arguments are sent in the order that the are defined here and are appended to
the arguments already defined on the opentofu service. They must follow the
key=value syntax and the service must support the inputs.
--state string The state file to utilize while running the plan. If a file path is specified
with '@' the resulting state file will be saved there as well (unless state-out
is specified)
--state-out string Path to write the resulting state file that is different than --state. This can
be used to preserve the old state file.
--use Display the possible inputs of the plan via the decorator.
Options inherited from parent commands
--config string Path to the configuration file
--raw Displays the result of the command in its raw format
--verbose Enable verbose output
SEE ALSO
- torero run opentofu-plan - Execute either the 'apply' or 'destroy' OpenTofu command