Class: Ruby::Terraform::Tasks::AllTasks

Inherits:
BaseTask
  • Object
show all
Defined in:
lib/ruby/terraform/tasks/all_tasks.rb

Instance Attribute Summary collapse

Attributes inherited from BaseTask

#configuration_name, #deps, #description, #dir, #show_command, #show_output, #task_name

Instance Method Summary collapse

Methods inherited from BaseTask

#initialize

Constructor Details

This class inherits a constructor from Ruby::Terraform::Tasks::BaseTask

Instance Attribute Details

#auto_approveObject

Returns the value of attribute auto_approve.



8
9
10
# File 'lib/ruby/terraform/tasks/all_tasks.rb', line 8

def auto_approve
  @auto_approve
end

#backendObject

Returns the value of attribute backend.



10
11
12
# File 'lib/ruby/terraform/tasks/all_tasks.rb', line 10

def backend
  @backend
end

#backend_configObject

Returns the value of attribute backend_config.



11
12
13
# File 'lib/ruby/terraform/tasks/all_tasks.rb', line 11

def backend_config
  @backend_config
end

#build_dirObject

Returns the value of attribute build_dir.



15
16
17
# File 'lib/ruby/terraform/tasks/all_tasks.rb', line 15

def build_dir
  @build_dir
end

#jsonObject

Returns the value of attribute json.



13
14
15
# File 'lib/ruby/terraform/tasks/all_tasks.rb', line 13

def json
  @json
end

#stateObject

Returns the value of attribute state.



6
7
8
# File 'lib/ruby/terraform/tasks/all_tasks.rb', line 6

def state
  @state
end

#varsObject

Returns the value of attribute vars.



7
8
9
# File 'lib/ruby/terraform/tasks/all_tasks.rb', line 7

def vars
  @vars
end

Instance Method Details

#defineObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/ruby/terraform/tasks/all_tasks.rb', line 17

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