Class: TerraspaceBundler::Terrafile

Inherits:
Object
  • Object
show all
Extended by:
Memoist
Includes:
Singleton, TB::Util::Logging
Defined in:
lib/terraspace_bundler/terrafile.rb

Instance Method Summary collapse

Instance Method Details

#missing_org?Boolean

Checks if any of the mods defined in Terrafile has an inferred an org In this case the org must be set When a source is set with an inferred org and org is not set it looks like this:

dsl.meta has {:source=>"terraform-random-pet"}
mod.source = "terraform-random-pet"

Using info to detect that the org is missing and the Terrafile definition has at least one mod line that has an inferred org.

Returns:

  • (Boolean)


34
35
36
# File 'lib/terraspace_bundler/terrafile.rb', line 34

def missing_org?
  mods.detect { |mod| mod.source.split('/').size == 1 } && TB.config.org.nil?
end

#modsObject

dsl meta example: :global=>{:org=>“boltopspro”, :mods=>

[{:args=>["eks"], :options=>{:source=>"terraform-aws-eks"}},
{:args=>["vpc"], :options=>{:source=>"terraform-aws-vpc"}}]}


12
13
14
15
16
# File 'lib/terraspace_bundler/terrafile.rb', line 12

def mods
  TB.dsl.meta[:mods].map do |params|
    new_mod(params)
  end
end

#new_mod(params) ⇒ Object



19
20
21
22
# File 'lib/terraspace_bundler/terrafile.rb', line 19

def new_mod(params)
  props = Mod::Props.new(params).build
  Mod.new(props)
end