Module: Terraspace::Compiler::Dependencies::Helpers
- Included in:
- Terraspace::Compiler::Dsl::Syntax::Tfvar, Erb::Helpers
- Defined in:
- lib/terraspace/compiler/dependencies/helpers.rb
Overview
This is a separate module specifically because the DSL also has an output method. The module allows us to include dependency related methods only within tfvars context for the DSL.
1. Only include this module to DSL tfvars context.
So the output method works in tfvars .rb files works.
At the same time, the DSL usage of output also works for normal main.tf files.
Passing specs prove this.
2. For ERB, there's currently only one ERB context. So this module is included in all contexts.
The builder only processes dependencies from tfvars, so these helpers are only respected there.
Where the module is included in the code:
1. lib/terraspace/compiler/dsl/syntax/tfvar.rb
2. lib/terraspace/compiler/erb/helpers.rb
Instance Method Summary collapse
- #depends_on(*child_names, **options) ⇒ Object
- #each_depends_on(child_name, options = {}) ⇒ Object
- #output(identifier, options = {}) ⇒ Object (also: #terraform_output)
Instance Method Details
#depends_on(*child_names, **options) ⇒ Object
23 24 25 26 27 28 |
# File 'lib/terraspace/compiler/dependencies/helpers.rb', line 23 def depends_on(*child_names, **) child_names.flatten! child_names.map do |child_name| each_depends_on(child_name, ) end.join("\n") end |
#each_depends_on(child_name, options = {}) ⇒ Object
30 31 32 |
# File 'lib/terraspace/compiler/dependencies/helpers.rb', line 30 def each_depends_on(child_name, ={}) Terraspace::Dependency::Helper::DependsOn.new(@mod, child_name, ).result end |
#output(identifier, options = {}) ⇒ Object Also known as: terraform_output
18 19 20 |
# File 'lib/terraspace/compiler/dependencies/helpers.rb', line 18 def output(identifier, ={}) Terraspace::Dependency::Helper::Output.new(@mod, identifier, ).result end |