Module: Genesis::Commands

Included in:
Cli
Defined in:
lib/genesis/commands.rb

Instance Method Summary collapse

Instance Method Details

#apply_commandObject



19
20
21
22
23
24
25
26
27
28
29
# 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_commandObject



58
59
60
61
62
63
64
# File 'lib/genesis/commands.rb', line 58

def apply_plan_command
  %W[
    terraform apply
    -state=#{state_file}
    #{plan_file}
  ].join(' ')
end

#destroy_plan_commandObject



5
6
7
8
9
10
11
12
13
14
15
16
17
# 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_commandObject



42
43
44
45
46
47
48
49
50
51
52
# 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_commandObject



31
32
33
34
35
36
37
38
39
40
# 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_commandObject



54
55
56
# File 'lib/genesis/commands.rb', line 54

def show_command
  "terraform show #{state_file}"
end