Class: Terradactyl::ConfigApplication

Inherits:
Object
  • Object
show all
Defined in:
lib/terradactyl/config.rb

Direct Known Subclasses

ConfigProject, ConfigStack

Constant Summary collapse

CONFIG_DEFAULTS =
<<~CONFIG_DEFAULTS
  ---
  terradactyl:
    base_folder: stacks
    terraform:
      binary:
      version:
      autoinstall: true
      install_dir:
      echo: false
      quiet: true
      init:
        lock: false
        force_copy: true
      plan:
        lock: false
        parallelism: 5
        detailed_exitcode: true
      apply:
        parallelism: 5
      refresh:
        input: false
      destroy:
        parallelism: 5
        auto_approve: true
    environment:
      TF_PLUGIN_CACHE_DIR: ~/.terraform.d/plugins
      TF_PLUGIN_CACHE_MAY_BREAK_DEPENDENCY_LOCK_FILE: 'true'
    misc:
      utf8: true
      disable_color: false
    cleanup:
      empty: true
      match:
        - "*.tfout"
        - "*.tflock"
        - "*.zip"
        - ".terraform"
CONFIG_DEFAULTS

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config_file = nil, defaults: nil) ⇒ ConfigApplication

Returns a new instance of ConfigApplication.



47
48
49
50
51
52
# File 'lib/terradactyl/config.rb', line 47

def initialize(config_file = nil, defaults: nil)
  @config_file = config_file
  @defaults    = load_defaults(defaults)
  @overlay     = load_overlay(config_file)
  load_config
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(sym, *args, &block) ⇒ Object (private)



103
104
105
106
107
# File 'lib/terradactyl/config.rb', line 103

def method_missing(sym, *args, &block)
  terradactyl.send(sym.to_sym, *args, &block)
rescue NameError
  super
end

Instance Attribute Details

#config_fileObject (readonly)

Returns the value of attribute config_file.



45
46
47
# File 'lib/terradactyl/config.rb', line 45

def config_file
  @config_file
end

#terradactylObject (readonly)

Returns the value of attribute terradactyl.



45
46
47
# File 'lib/terradactyl/config.rb', line 45

def terradactyl
  @terradactyl
end

Instance Method Details

#reloadObject



54
55
56
# File 'lib/terradactyl/config.rb', line 54

def reload
  load_config
end

#to_hObject Also known as: to_hash



58
59
60
# File 'lib/terradactyl/config.rb', line 58

def to_h
  @config
end