Class: Ruby::Terraform::Commands::ValidateCommand

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ExecutionSupport

#execute, #tf_binary

Constructor Details

#initialize(opts = {}) ⇒ ValidateCommand

Returns a new instance of ValidateCommand.



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

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

Instance Attribute Details

#dirObject

Returns the value of attribute dir.



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

def dir
  @dir
end

#jsonObject

Returns the value of attribute json.



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

def json
  @json
end

Instance Method Details

#commandObject



15
16
17
18
19
20
21
22
# File 'lib/ruby/terraform/commands/validate_command.rb', line 15

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

  cmd += ['-json'] if json

  cmd += [dir] if dir
  cmd
end