Sha256: 1d91674c3a37b4121376f167ea1bc8676590d383ba8ec77700a884d3aa17eb12

Contents?: true

Size: 1.38 KB

Versions: 91

Compression:

Stored size: 1.38 KB

Contents

module Terraspace::Compiler::Dependencies
  # 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
  #
  module Helpers
    def output(identifier, options={})
      Terraspace::Dependency::Helper::Output.new(@mod, identifier, options).result
    end
    alias_method :terraform_output, :output # backwards compatibility

    def depends_on(*child_names, **options)
      child_names.flatten!
      child_names.map do |child_name|
        each_depends_on(child_name, options)
      end.join("\n")
    end

    def each_depends_on(child_name, options={})
      Terraspace::Dependency::Helper::DependsOn.new(@mod, child_name, options).result
    end
  end
end

Version data entries

91 entries across 91 versions & 1 rubygems

Version Path
terraspace-2.2.17 lib/terraspace/compiler/dependencies/helpers.rb
terraspace-2.2.16 lib/terraspace/compiler/dependencies/helpers.rb
terraspace-2.2.15 lib/terraspace/compiler/dependencies/helpers.rb
terraspace-2.2.14 lib/terraspace/compiler/dependencies/helpers.rb
terraspace-2.2.13 lib/terraspace/compiler/dependencies/helpers.rb
terraspace-2.2.12 lib/terraspace/compiler/dependencies/helpers.rb
terraspace-2.2.11 lib/terraspace/compiler/dependencies/helpers.rb
terraspace-2.2.10 lib/terraspace/compiler/dependencies/helpers.rb
terraspace-2.2.9 lib/terraspace/compiler/dependencies/helpers.rb
terraspace-2.2.8 lib/terraspace/compiler/dependencies/helpers.rb
terraspace-2.2.7 lib/terraspace/compiler/dependencies/helpers.rb
terraspace-2.2.6 lib/terraspace/compiler/dependencies/helpers.rb
terraspace-2.2.5 lib/terraspace/compiler/dependencies/helpers.rb
terraspace-2.2.4 lib/terraspace/compiler/dependencies/helpers.rb
terraspace-2.2.3 lib/terraspace/compiler/dependencies/helpers.rb
terraspace-2.2.2 lib/terraspace/compiler/dependencies/helpers.rb
terraspace-2.2.1 lib/terraspace/compiler/dependencies/helpers.rb
terraspace-2.2.0 lib/terraspace/compiler/dependencies/helpers.rb
terraspace-2.1.7 lib/terraspace/compiler/dependencies/helpers.rb
terraspace-2.1.6 lib/terraspace/compiler/dependencies/helpers.rb