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.
146 147 148 149 150 |
# File 'lib/terrafying/generator.rb', line 146 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
164 165 166 |
# File 'lib/terrafying/generator.rb', line 164 def method_missing(fn, *args) resource(fn, args.shift.to_s, args.first) end |
Instance Method Details
#backend(name, spec) ⇒ Object
152 153 154 155 156 157 158 |
# File 'lib/terrafying/generator.rb', line 152 def backend(name, spec) @output["terraform"] = { backend: { name => spec, }, } end |
#generate(&block) ⇒ Object
160 161 162 |
# File 'lib/terrafying/generator.rb', line 160 def generate(&block) instance_eval(&block) end |