module Terraform::Binary

The Binary namespace handles sub-commands using {#method_missing} metaprogramming as well as the global configuration object

Constants

TERRAFORM_VERSION

The version number of the Terraform binary to download and use

VERSION

Gem Version

Attributes

config[W]

@!attribute config

@return [Configuration] the global configuration object

Public Instance Methods

config() click to toggle source

defines the @config class variable

# File lib/terraform/binary.rb, line 23
def config
  @config ||= Configuration.new
end
configure() { |config| ... } click to toggle source

Set the global settings. See the {file:README.md README} for more information

# File lib/terraform/binary.rb, line 28
def configure
  yield(config)
end
method_missing(method, *args, &block) click to toggle source

This method maps Terraform::Binary method calls to Terraform sub-commands Ex. to run `terraform plan -machine-readable test/dir`:

“`ruby Terraform::Binary.plan('-machine-readable test/dir') “`

@note if the method is an invalid sub-command or if the command fails

you will get a {Command::CommandFailure} exception

@since 0.2.0

Calls superclass method
# File lib/terraform/binary.rb, line 42
def method_missing(method, *args, &block)
  if method.to_s =~ /(\w+)/
    Terraform::Binary::Helpers.debug("#{method.to_s.downcase} #{args.join(' ')}")
    Command.run("#{method.to_s.downcase} #{args.join(' ')}")
  else
    super
  end
end
respond_to_missing?(method, *) click to toggle source
Calls superclass method
# File lib/terraform/binary.rb, line 51
def respond_to_missing?(method, *)
  method =~ /(\w+)/ || super
end