class RubyTerraform::Commands::Init

Wraps the +terraform init+ command which initializes a new or existing Terraform working directory by creating initial files, loading any remote state, downloading modules, etc.

This is the first command that should be run for any new or existing Terraform configuration per machine. This sets up all the local data necessary to run Terraform that is typically not committed to version control.

This command is always safe to run multiple times. Though subsequent runs may give errors, this command will never delete your configuration or state. Even so, if you have important information, please back it up prior to running this command, just in case.

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

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

@example Basic Invocation

RubyTerraform::Commands::Init.new.execute(
  from_module: 'some/module/path',
  path: 'infra/module')

Public Instance Methods

arguments(parameters) click to toggle source

@!visibility private

# File lib/ruby_terraform/commands/init.rb, line 114
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/init.rb, line 91
def options
  %w[
    -backend
    -backend-config
    -force-copy
    -from-module
    -get
    -get-plugins
    -input
    -lock
    -lock-timeout
    -no-color
    -plugin-dir
    -reconfigure
    -upgrade
    -verify-plugins
    -lockfile
  ] + super
end
parameter_defaults(_parameters) click to toggle source

@!visibility private

# File lib/ruby_terraform/commands/init.rb, line 119
def parameter_defaults(_parameters)
  { backend_config: {} }
end
subcommands() click to toggle source

@!visibility private

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