module Ruby module Terraform module Tasks class AllTasks < BaseTask attr_accessor :state attr_accessor :vars attr_accessor :auto_approve attr_accessor :backend attr_accessor :backend_config attr_accessor :json attr_accessor :build_dir def define dir_to_use = File.expand_path(build_dir ? "#{build_dir}/#{dir}" : dir) if build_dir task :pre_init do rm_rf dir_to_use mkdir_p File.dirname(dir_to_use) # create parent dir cp_r dir, dir_to_use end end InitTask.new(configuration_name, :init => build_dir ? [:pre_init] : []) do |task| task.dir = dir_to_use task.backend = backend task.backend_config = backend_config task.show_output = show_output task.show_command = show_command end ApplyTask.new(configuration_name, :apply => :init) do |task| task.dir = dir_to_use task.state = state task.vars = vars task.auto_approve = auto_approve task.show_output = show_output task.show_command = show_command end DestroyTask.new(configuration_name, :destroy => :init) do |task| task.dir = dir_to_use task.state = state task.vars = vars task.auto_approve = auto_approve task.show_output = show_output task.show_command = show_command end OutputTask.new(configuration_name, :output => :init) do |task| task.dir = dir_to_use task.state = state task.json = json task.show_output = show_output task.show_command = show_command end PlanTask.new(configuration_name, :plan => :init) do |task| task.dir = dir_to_use task.state = state task.vars = vars task.show_output = show_output task.show_command = show_command end ValidateTask.new(configuration_name, :validate => :init) do |task| task.dir = dir_to_use task.json = json task.show_output = show_output task.show_command = show_command end end end end end end