class Ruby::Terraform::Commands::PlanCommand
Attributes
dir[RW]
state[RW]
vars[RW]
Public Class Methods
new(opts = {})
click to toggle source
# File lib/ruby/terraform/commands/plan_command.rb, line 11 def initialize(opts = {}) @dir = opts[:dir] @state = opts[:state] @vars = opts[:vars] end
Public Instance Methods
command()
click to toggle source
# File lib/ruby/terraform/commands/plan_command.rb, line 17 def command cmd = %W[#{tf_binary} plan] cmd += ['-state', state] if state if vars vars.each do |key, value| var_value = value.is_a?(String) ? value : JSON.generate(value) cmd += ['-var', "#{key}=#{var_value}"] end end cmd += [dir] if dir cmd end