class Covalence::Stack

Public Class Methods

new(attributes = {}, *arguments) click to toggle source
Calls superclass method
# File lib/covalence/core/entities/stack.rb, line 35
def initialize(attributes = {}, *arguments)
  super
  self.valid?
end

Public Instance Methods

full_name() click to toggle source
# File lib/covalence/core/entities/stack.rb, line 40
def full_name
  "#{environment_name}-#{name}"
end
logger() click to toggle source
# File lib/covalence/core/entities/stack.rb, line 69
def logger
  Covalence::LOGGER
end
materialize_cmd_inputs(path) click to toggle source
# File lib/covalence/core/entities/stack.rb, line 44
def materialize_cmd_inputs(path)
  if type == "terraform"
    config = ""
    inputs.values.map(&:to_command_option).each do |input|
      config += input + "\n"
    end
    logger.info "#{module_path} \nStack inputs:\n\n#{config}"
    File.open("#{path}/covalence-inputs.tfvars",'w') {|f| f.write(config)}
  elsif type == "packer"
    config = Hash.new
    inputs.values.map(&:to_command_hash_elements).each do |name, input|
      config["#{name}"] = input
    end
    config_json = JSON.generate(config)
    logger.info "path: #{path} module_path: #{module_path}\nStack inputs:\n\n#{config_json}"
    File.open("#{path}/covalence-inputs.json",'w') {|f| f.write(config_json)}
  end
end
materialize_state_inputs(store: state_stores.first, path: '.') click to toggle source
# File lib/covalence/core/entities/stack.rb, line 63
def materialize_state_inputs(store: state_stores.first, path: '.')
  config = store.get_config
  logger.info "\nState store configuration:\n\n#{config}"
  File.open("#{path}/covalence-state.tf",'w') {|f| f.write(config)}
end