Sha256: 80c4de4526c07d351d3c501c25a4ce7b8e43962b30c44c804cf99822b4a50f22

Contents?: true

Size: 1.46 KB

Versions: 32

Compression:

Stored size: 1.46 KB

Contents

require 'ruby_terraform/version'
require 'ruby_terraform/commands'

module RubyTerraform
  class << self
    attr_writer :configuration

    def configuration
      @configuration ||= Configuration.new
    end

    def configure
      yield(configuration)
    end

    def reset!
      @configuration = nil
    end
  end

  module ClassMethods
    def clean(opts = {})
      Commands::Clean.new.execute(opts)
    end

    def init(opts = {})
      Commands::Init.new.execute(opts)
    end

    def get(opts = {})
      Commands::Get.new.execute(opts)
    end

    def validate(opts = {})
      Commands::Validate.new.execute(opts)
    end

    def plan(opts = {})
      Commands::Plan.new.execute(opts)
    end

    def apply(opts = {})
      Commands::Apply.new.execute(opts)
    end

    def destroy(opts = {})
      Commands::Destroy.new.execute(opts)
    end

    def remote_config(opts = {})
      Commands::RemoteConfig.new.execute(opts)
    end

    def refresh(opts = {})
      Commands::Refresh.new.execute(opts)
    end

    def output(opts = {})
      Commands::Output.new.execute(opts)
    end

    def output_from_remote(opts)
      output_name = opts[:name]
      remote_opts = opts[:remote]

      clean
      remote_config(remote_opts)
      output(name: output_name)
    end
  end
  extend ClassMethods

  def self.included(other)
    other.extend(ClassMethods)
  end

  class Configuration
    attr_accessor :binary

    def initialize
      @binary = 'terraform'
    end
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
ruby-terraform-0.13.2.pre37 lib/ruby_terraform.rb
ruby-terraform-0.13.2.pre36 lib/ruby_terraform.rb
ruby-terraform-0.13.2.pre35 lib/ruby_terraform.rb
ruby-terraform-0.13.2.pre34 lib/ruby_terraform.rb
ruby-terraform-0.13.2.pre33 lib/ruby_terraform.rb
ruby-terraform-0.13.2.pre32 lib/ruby_terraform.rb
ruby-terraform-0.13.2.pre31 lib/ruby_terraform.rb
ruby-terraform-0.13.1 lib/ruby_terraform.rb
ruby-terraform-0.13.0 lib/ruby_terraform.rb
ruby-terraform-0.12.1 lib/ruby_terraform.rb
ruby-terraform-0.12.0 lib/ruby_terraform.rb
ruby-terraform-0.11.2 lib/ruby_terraform.rb