Class: Terrafying::RootContext
- Defined in:
- lib/terrafying/generator.rb
Constant Summary
Constants inherited from Context
Context::PROVIDER_DEFAULTS, Context::REGION
Instance Attribute Summary
Attributes inherited from Context
Instance Method Summary collapse
- #backend(name, spec) ⇒ Object
- #generate(&block) ⇒ Object
-
#initialize ⇒ RootContext
constructor
A new instance of RootContext.
- #method_missing(fn, *args) ⇒ Object
Methods inherited from Context
#add!, #aws, #data, #id_of, #output_of, #output_with_children, #pretty_generate, #provider, #resource, #resource_names, #resources, #template, #tf_safe
Constructor Details
#initialize ⇒ RootContext
Returns a new instance of RootContext.
140 141 142 143 144 |
# File 'lib/terrafying/generator.rb', line 140 def initialize super output["provider"] = PROVIDER_DEFAULTS end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(fn, *args) ⇒ Object
158 159 160 |
# File 'lib/terrafying/generator.rb', line 158 def method_missing(fn, *args) resource(fn, args.shift.to_s, args.first) end |
Instance Method Details
#backend(name, spec) ⇒ Object
146 147 148 149 150 151 152 |
# File 'lib/terrafying/generator.rb', line 146 def backend(name, spec) @output["terraform"] = { backend: { name => spec, }, } end |
#generate(&block) ⇒ Object
154 155 156 |
# File 'lib/terrafying/generator.rb', line 154 def generate(&block) instance_eval(&block) end |