Class: Ruby::Terraform::Commands::OutputCommand

Inherits:
Object
  • Object
show all
Includes:
ExecutionSupport
Defined in:
lib/ruby/terraform/commands/output_command.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ExecutionSupport

#execute, #tf_binary

Constructor Details

#initialize(opts = {}) ⇒ OutputCommand

Returns a new instance of OutputCommand.



12
13
14
15
16
17
# File 'lib/ruby/terraform/commands/output_command.rb', line 12

def initialize(opts = {})
  @dir = opts[:dir]
  @state = opts[:state]
  @json = opts[:json]
  @name = opts[:name]
end

Instance Attribute Details

#dirObject

Returns the value of attribute dir.



7
8
9
# File 'lib/ruby/terraform/commands/output_command.rb', line 7

def dir
  @dir
end

#jsonObject

Returns the value of attribute json.



9
10
11
# File 'lib/ruby/terraform/commands/output_command.rb', line 9

def json
  @json
end

#nameObject

Returns the value of attribute name.



10
11
12
# File 'lib/ruby/terraform/commands/output_command.rb', line 10

def name
  @name
end

#stateObject

Returns the value of attribute state.



8
9
10
# File 'lib/ruby/terraform/commands/output_command.rb', line 8

def state
  @state
end

Instance Method Details

#commandObject



19
20
21
22
23
24
25
26
# File 'lib/ruby/terraform/commands/output_command.rb', line 19

def command
  cmd = %W[#{tf_binary} output]

  cmd += ['-state', state] if state
  cmd += ['-json'] if json
  cmd += [name] if name
  cmd
end