Sha256: b0fb9404877c9eddc2d09b45744d8a13e8b4848c82a0ba37605ff73b063dec3f

Contents?: true

Size: 599 Bytes

Versions: 5

Compression:

Stored size: 599 Bytes

Contents

require 'mustache'

module TerraformDevKit
  class TerraformTemplateConfigFile
    def initialize(content, env, aws_config, extra_vars: {})
      @content = content
      @env = env
      @aws_config = aws_config
      @extra_vars = extra_vars
    end

    def render
      args = {
        Profile: @aws_config.fetch('profile', ''),
        Region:  @aws_config.fetch('region'),
        Environment: @env.name,
        LocalBackend: @env.local_backend?
      }
      args.merge!(@extra_vars)
      Mustache.render(
        @content,
        args
      )
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
TerraformDevKit-0.1.14 lib/TerraformDevKit/terraform_template_config_file.rb
TerraformDevKit-0.1.13 lib/TerraformDevKit/terraform_template_config_file.rb
TerraformDevKit-0.1.12 lib/TerraformDevKit/terraform_template_config_file.rb
TerraformDevKit-0.1.11 lib/TerraformDevKit/terraform_template_config_file.rb
TerraformDevKit-0.1.10 lib/TerraformDevKit/terraform_template_config_file.rb