aboutsummaryrefslogtreecommitdiff
path: root/app/jobs/terraform_job.rb
blob: 739a5b5de0346021dc4f8f43f04db70db3a39fb2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
class TerraformJob < Que::Job
  def run(mini_environment_id)
    ActiveRecord::Base.transaction do
      @mini_environment = MiniEnvironment.find(mini_environment_id)

      run_terraform
    end
  end
  
  def destroy
    FinishedTerraformJob.create(
      mini_environment_id: @mini_environment.id,
      job_class: attrs[:job_class]
    )
    super
  end
end