class TerraspaceBundler::Terrafile

Public Instance Methods

missing_org?() click to toggle source

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.

# File lib/terraspace_bundler/terrafile.rb, line 34
def missing_org?
  mods.detect { |mod| mod.source.split('/').size == 1 } && TB.config.org.nil?
end
mods() click to toggle source

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

[{:args=>["eks"], :options=>{:source=>"terraform-aws-eks"}},
{:args=>["vpc"], :options=>{:source=>"terraform-aws-vpc"}}]}
# 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) click to toggle source
# File lib/terraspace_bundler/terrafile.rb, line 19
def new_mod(params)
  props = Mod::Props.new(params).build
  Mod.new(props)
end