class DestroyJob < MiniEnvironmentJob @retry_interval = 30 def run_terraform puts "Destroying #{@mini_environment.name}" Dir.chdir('terraform/aws') do RubyTerraform.destroy( vars: { aws_region: 'eu-west-1', slug: @mini_environment.name.parameterize, ssh_public_key: ssh_public_key, start_command: @mini_environment.start_command }, force: true ) end end def ssh_public_key File.open("#{ENV['HOME']}/.ssh/id_rsa.pub") do |file| file.readline() end end end