class RubyTerraform::Commands::Refresh

Wraps the +terraform refresh+ command which updates the state file of your infrastructure with metadata that matches the physical resources they are tracking.

This will not modify your infrastructure, but it can modify your state file to update metadata. This metadata might cause new changes to occur when you generate a plan or call apply next.

For options accepted on construction, see {#initialize}.

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

@example Basic Invocation

RubyTerraform::Commands::Refresh.new.execute(
  directory: 'infra/networking',
  vars: {
    region: 'eu-central'
  })

Public Instance Methods

arguments(parameters) click to toggle source

@!visibility private

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

@!visibility private

Calls superclass method RubyTerraform::Options::Global#options
# File lib/ruby_terraform/commands/refresh.rb, line 77
def options
  %w[
    -backup
    -compact-warnings
    -input
    -lock
    -lock-timeout
    -no-color
    -parallelism
    -state
    -state-out
    -target
    -var
    -var-file
  ] + super
end
parameter_defaults(_parameters) click to toggle source

@!visibility private

# File lib/ruby_terraform/commands/refresh.rb, line 102
def parameter_defaults(_parameters)
  { vars: {}, var_files: [], targets: [] }
end
parameter_overrides(parameters) click to toggle source

@!visibility private

# File lib/ruby_terraform/commands/refresh.rb, line 107
def parameter_overrides(parameters)
  { backup: parameters[:no_backup] ? '-' : parameters[:backup] }
end
subcommands() click to toggle source

@!visibility private

# File lib/ruby_terraform/commands/refresh.rb, line 70
def subcommands
  %w[refresh]
end