Class: TerraformDSL::Outputs

Inherits:
Object
  • Object
show all
Defined in:
lib/terraformdsl/common.rb

Instance Method Summary collapse

Constructor Details

#initializeOutputs

Returns a new instance of Outputs.



88
89
90
# File 'lib/terraformdsl/common.rb', line 88

def initialize
  @dict = {}
end

Instance Method Details

#define(key, val) ⇒ Object Also known as: []=



92
93
94
# File 'lib/terraformdsl/common.rb', line 92

def define(key, val)
  @dict[key] = val
end

#generate_tfObject



98
99
100
101
102
103
104
105
106
107
# File 'lib/terraformdsl/common.rb', line 98

def generate_tf
  tf = ""
  @dict.each do |k, v|
    tf << "output \"#{k}\" {\n"
    tf << "  value = \"#{v}\"\n"
    tf << "}\n"
    tf << "\n"
  end
  return tf
end