class RubyTerraform::Commands::StatePush

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 {#initialize}.

When executing an instance of {StatePush} via {#execute}, the following options are supported:

@example Basic Invocation

RubyTerraform::Commands::StatePush.new.execute(
  path: 'some/statefile.tfstate')

Public Instance Methods

arguments(parameters) click to toggle source

@!visibility private

# File lib/ruby_terraform/commands/state_push.rb, line 65
def arguments(parameters)
  [parameters[:path]]
end
options() click to toggle source

@!visibility private

Calls superclass method RubyTerraform::Options::Global#options
# File lib/ruby_terraform/commands/state_push.rb, line 55
def options
  %w[
    -force
    -lock
    -lock-timeout
    -ignore-remote-version
  ] + super
end
subcommands() click to toggle source

@!visibility private

# File lib/ruby_terraform/commands/state_push.rb, line 50
def subcommands
  %w[state push]
end