class RubyTerraform::Commands::Output

Wraps the +terraform output+ command which reads an output variable from a Terraform state file and prints the value. With no additional arguments, output will display all the outputs for the root module. If :name is not specified, all outputs are printed.

For options accepted on construction, see {#initialize}.

When executing an instance of {Output} via {#execute}, the following options are supported:

@example Basic Invocation

RubyTerraform::Commands::Output.new.execute(
  name: 'vpc_id')

Public Instance Methods

arguments(parameters) click to toggle source

@!visibility private

# File lib/ruby_terraform/commands/output.rb, line 60
def arguments(parameters)
  [parameters[:name]]
end
do_after(parameters) click to toggle source

@!visibility private

# File lib/ruby_terraform/commands/output.rb, line 65
def do_after(parameters)
  result = stdout.string
  parameters[:name] ? result.chomp : result
end
options() click to toggle source

@!visibility private

Calls superclass method RubyTerraform::Options::Global#options
# File lib/ruby_terraform/commands/output.rb, line 50
def options
  %w[
    -json
    -raw
    -no-color
    -state
  ] + super
end
stdout() click to toggle source

@!visibility private

# File lib/ruby_terraform/commands/output.rb, line 40
def stdout
  @stdout.respond_to?(:string) ? @stdout : (@stdout = StringIO.new)
end
subcommands() click to toggle source

@!visibility private

# File lib/ruby_terraform/commands/output.rb, line 45
def subcommands
  %w[output]
end