Class: Terradactyl::ConfigStack

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

Constant Summary collapse

TERRAFORM_SETTINGS_FILES =
%w[
  settings.tf
  versions.tf
  backend.tf
].freeze

Constants inherited from ConfigApplication

Terradactyl::ConfigApplication::CONFIG_DEFAULTS

Instance Attribute Summary collapse

Attributes inherited from ConfigApplication

#config_file, #terradactyl

Instance Method Summary collapse

Methods inherited from ConfigApplication

#reload, #to_h

Constructor Details

#initialize(stack_name, base_override = nil) ⇒ ConfigStack

Returns a new instance of ConfigStack.



162
163
164
165
166
167
168
169
170
171
172
# File 'lib/terradactyl/config.rb', line 162

def initialize(stack_name, base_override = nil)
  @stack_name     = stack_name
  @project_config = ConfigProject.instance
  @base_folder    = base_override || @project_config.base_folder
  @stack_path     = "#{@base_folder}/#{@stack_name}"
  @config_file    = "#{@stack_path}/#{ConfigProject::CONFIG_PROJECT_FILE}"
  @defaults       = load_defaults(@project_config.to_h)
  @overlay        = load_overlay(@config_file)

  load_config
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Terradactyl::ConfigApplication

Instance Attribute Details

#base_folderObject (readonly)

Returns the value of attribute base_folder.



160
161
162
# File 'lib/terradactyl/config.rb', line 160

def base_folder
  @base_folder
end

#stack_nameObject (readonly) Also known as: name

Returns the value of attribute stack_name.



160
161
162
# File 'lib/terradactyl/config.rb', line 160

def stack_name
  @stack_name
end

#stack_pathObject (readonly) Also known as: path

Returns the value of attribute stack_path.



160
161
162
# File 'lib/terradactyl/config.rb', line 160

def stack_path
  @stack_path
end

Instance Method Details

#plan_fileObject



185
186
187
# File 'lib/terradactyl/config.rb', line 185

def plan_file
  "#{stack_name}.tfout"
end

#plan_pathObject



189
190
191
# File 'lib/terradactyl/config.rb', line 189

def plan_path
  "#{stack_path}/#{plan_file}"
end

#state_fileObject



177
178
179
# File 'lib/terradactyl/config.rb', line 177

def state_file
  'terraform.tfstate'
end

#state_pathObject



181
182
183
# File 'lib/terradactyl/config.rb', line 181

def state_path
  "#{stack_path}/terraform.tfstate"
end

#versions_fileObject



193
194
195
# File 'lib/terradactyl/config.rb', line 193

def versions_file
  "#{stack_path}/versions.tf"
end