lib/terraspace/builder.rb in terraspace-0.3.0 vs lib/terraspace/builder.rb in terraspace-0.3.1

- old
+ new

@@ -12,10 +12,11 @@ build_dir = Util.pretty_path(@mod.cache_dir) placeholder_stack_message logger.info "Building #{build_dir}" unless @options[:quiet] # from terraspace all build_unresolved + auto_create_backend batches = build_batches build_all logger.info "Built in #{build_dir}" unless @options[:quiet] # from terraspace all batches end @@ -50,9 +51,20 @@ mod.resolved = @resolved is_root_module = mod.cache_dir == @mod.cache_dir next if is_root_module # handled by build_root_module Compiler::Builder.new(mod).build end + end + + # Auto create after build_unresolved since will need to run state pull for dependencies + def auto_create_backend + return unless create_backend? + Terraspace::Compiler::Backend.new(@mod).create + end + + def create_backend? + ARGV[0] == "up" || # terraspace up + ARGV[0] == "all" && ARGV[1] == "up" # terraspace up end def clean Compiler::Cleaner.new(@mod, @options).clean if clean? end