Class: RubyTerraform::Commands::StatePush
- Includes:
- Options::Global
- Defined in:
- lib/ruby_terraform/commands/state_push.rb
Overview
Wraps the terraform state push command which updates remote state from
a local state file.
This command "pushes" a local state and overwrites remote state with a
local state file. The command will protect you against writing
an older serial or a different state file lineage unless you pass true
for the :force option.
This command works with local state (it will overwrite the local state), but is less useful for this use case.
If :path is "-", then this command will read the state to push from
stdin. Data from stdin is not streamed to the backend: it is loaded
completely (until pipe close), verified, and then pushed.
For options accepted on construction, see Base#initialize.
When executing an instance of StatePush via Base#execute, the following options are supported:
:path: the path to the state file to push; when passed"-"will read state from standard input.:chdir: the path of a working directory to switch to before executing the given subcommand.:force: whentrue, writes the state even if lineages don't match or the remote serial is higher; defaults tofalse.:lock: whentrue, locks the state file when locking is supported; whenfalse, does not lock the state file; defaults totrue.:lock_timeout: the duration to retry a state lock; defaults to"0s".:ignore_remote_version: whether or not to continue even if remote and local Terraform versions are incompatible; this may result in an unusable workspace, and should be used with extreme caution; defaults tofalse.
The Base#execute method accepts an optional second parameter which is a map
of invocation options. Currently, the only supported option is
:environment which is a map of environment variables to expose during
invocation of the command.
Constructor Details
This class inherits a constructor from RubyTerraform::Commands::Base