module Genesis::Commands
Public Instance Methods
apply_command()
click to toggle source
# File lib/genesis/commands.rb, line 19 def apply_command command = [] command << 'terraform apply' command << variables command.flatten! command << '-refresh=true' command << "-state=#{state_file}" command << "#{@terraform_dir}" command.join(' ') end
apply_plan_command()
click to toggle source
# File lib/genesis/commands.rb, line 58 def apply_plan_command %W[ terraform apply -state=#{state_file} #{plan_file} ].join(' ') end
destroy_plan_command()
click to toggle source
# File lib/genesis/commands.rb, line 5 def destroy_plan_command command = [] command << 'terraform plan' command << variables command.flatten! command << '-refresh=true' command << '-destroy' command << "-state=#{state_file}" command << "-out=#{plan_file}" command << "#{@terraform_dir}" command.join(' ') end
plan_command()
click to toggle source
# File lib/genesis/commands.rb, line 42 def plan_command command = [] command << 'terraform plan' command << variables command.flatten! command << '-refresh=true' command << "-state=#{state_file}" command << "#{@terraform_dir}" command.join(' ') end
refresh_command()
click to toggle source
# File lib/genesis/commands.rb, line 31 def refresh_command command = [] command << 'terraform refresh' command << variables command.flatten! command << "-state=#{state_file}" command << "#{@terraform_dir}" command.join(' ') end
show_command()
click to toggle source
# File lib/genesis/commands.rb, line 54 def show_command "terraform show #{state_file}" end
Private Instance Methods
variables()
click to toggle source
# File lib/genesis/commands.rb, line 68 def variables defaults = { aws_access_key: @aws_access_key, aws_secret_key: @aws_secret_key, aws_key_pair: @aws_key_pair } variables = defaults.merge(@vars) variables.reduce([]) do |data, (name, value)| data << "-var \"#{name}=#{value}\"" end end