Module: Proteus::Commands::Apply

Defined in:
lib/proteus/commands/apply.rb

Class Method Summary collapse

Class Method Details

.included(thor_class) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
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
# File 'lib/proteus/commands/apply.rb', line 4

def self.included(thor_class)
  thor_class.class_eval do

    desc 'apply', 'Applies the current terraform code'
    long_desc "      Applies the current terraform code\n    LONGDESC\n    def apply\n      init(verbose: parent_options[:verbose])\n\n      confirm question: \"Do you really want to run 'terraform apply' on environment '\#{environment}' in context '\#{context}'?\", color: :on_red, exit_code: 0 do\n\n\n        if !options[:dryrun]\n          slack_notification(\n              context:  context,\n              environment: environment,\n              message: 'is running terraform apply. Wait for it.'\n            )\n        end\n\n        apply_command = <<~APPLY_COMMAND\n          cd \#{context_path(context)} && \\\n          terraform apply \\\n          -input=true \\\n          -refresh=true \\\n          \#{plan_file(context, environment)}\n        APPLY_COMMAND\n\n        syscall apply_command.squeeze(' '), dryrun: dryrun\n\n        if !options[:dryrun]\n          slack_notification(\n              context: context,\n              environment: environment,\n              message: 'applied a new version of me!'\n            )\n        end\n      end\n    end\n  end\n\nend\n"