Class: Terraspace::Compiler::Builder

Inherits:
Object
  • Object
show all
Includes:
Basename
Defined in:
lib/terraspace/compiler/builder.rb

Instance Method Summary collapse

Methods included from Basename

#basename

Constructor Details

#initialize(mod) ⇒ Builder

Returns a new instance of Builder.



5
6
7
# File 'lib/terraspace/compiler/builder.rb', line 5

def initialize(mod)
  @mod = mod
end

Instance Method Details

#buildObject



9
10
11
12
13
# File 'lib/terraspace/compiler/builder.rb', line 9

def build
  build_config
  build_module
  build_tfvars
end

#build_configObject

build common config files: provider and backend for the root module



16
17
18
19
# File 'lib/terraspace/compiler/builder.rb', line 16

def build_config
  return unless build?
  build_config_templates
end

#build_moduleObject



21
22
23
24
25
# File 'lib/terraspace/compiler/builder.rb', line 21

def build_module
  with_mod_file do |src_path|
    build_mod_file(src_path)
  end
end

#build_tfvarsObject



27
28
29
30
# File 'lib/terraspace/compiler/builder.rb', line 27

def build_tfvars
  return unless build?
  Strategy::Tfvar.new(@mod).run # writer within Strategy to control file ordering
end