Class: Terraform::Remote

Inherits:
Command show all
Includes:
Aws::Remote_S3
Defined in:
lib/terraform_dsl/remote.rb

Defined Under Namespace

Classes: RemoteNotSupported

Instance Attribute Summary

Attributes inherited from Command

#command

Instance Method Summary collapse

Methods inherited from Command

#env

Constructor Details

#initialize(stack, command) ⇒ Remote

Returns a new instance of Remote.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/terraform_dsl/remote.rb', line 7

def initialize(stack, command)
  super
  unless @stack.remote.first
    puts "\tWARNING: #{@stack.name} is not configured with a remote backend"
    return
  end

  backend = @stack.remote.keys.first
  sym = "options_for_#{backend}"

  if self.respond_to?(sym, include_private: true)
    @command = send(sym, command)
  else
    fail RemoteNotSupported, "Remote backend #{backend} is not supported yet"
  end
end

Instance Method Details

#executeObject



24
25
26
27
# File 'lib/terraform_dsl/remote.rb', line 24

def execute
  return unless @stack.remote.first
  super
end