Module: Proteus::Commands::Output

Defined in:
lib/proteus/commands/output.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
# File 'lib/proteus/commands/output.rb', line 4

def self.included(thor_class)
  thor_class.class_eval do

    desc "output", "Query Terraform outputs"
    long_desc <<-LONGDESC
      Query Terraform outputs.
    LONGDESC
    option :name, type: :string, default: nil, required: false
    def output

      init(verbose: parent_options[:verbose])

      terraform_command = <<~TERRAFORM_COMMAND
        cd #{context_path(context)} && \
        terraform output \
        -state=#{state_file(context, environment)} \
        #{options[:name] ? options[:name] : ''}
      TERRAFORM_COMMAND

      syscall(terraform_command.squeeze(' '))
    end
  end
end