class Terraspace::CLI::Build::Placeholder
Public Class Methods
new(options={})
click to toggle source
# File lib/terraspace/cli/build/placeholder.rb, line 8 def initialize(options={}) @options = options end
Public Instance Methods
build()
click to toggle source
Grab the last module and build that. Assume the backend key has the same prefix Note: Tried building a empty “null” stack but with TFC a null space workspace is created, which is undesired.
# File lib/terraspace/cli/build/placeholder.rb, line 15 def build return if ENV['TS_SUMMARY_BUILD'] == '0' mod = @options[:mod] if !mod or %w[placeholder].include?(mod) logger.info "Building one of the modules to get backend.tf info" mod = find_stack end Terraspace::Builder.new(@options.merge(mod: mod, init: false)).run # generate and init Terraspace::Mod.new(mod, @options) # mod metadata end
find_stack()
click to toggle source
Used by: terraspace build placeholder
# File lib/terraspace/cli/build/placeholder.rb, line 28 def find_stack stack_paths = Dir.glob("{app,vendor}/stacks/*") stack_paths.select! do |path| select = Terraspace::Compiler::Select.new(path) select.selected? end mod_path = stack_paths.last unless mod_path logger.info "No stacks found." exit 0 end File.basename(mod_path) # mod name end