class RubyTerraform::Commands::Apply

Wraps the +terraform apply+ command which creates or updates infrastructure according to terraform configuration files in the provided directory.

By default, terraform will generate a new plan and present it for approval before taking any action. Alternatively, the command accepts a plan file created by a previous invocation, in which case terraform will take the actions described in that plan without any confirmation prompt.

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

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

@example Basic Invocation

RubyTerraform::Commands::Apply.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/apply.rb, line 106
def arguments(parameters)
  [parameters[:plan] || parameters[:directory]]
end
options() click to toggle source

@!visibility private

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

@!visibility private

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

@!visibility private

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

@!visibility private

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