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
- #output_with_children ⇒ Object
Methods inherited from Context
#add!, #aws, bundle, #data, #id_of, #key_exists_spec_differs, #local, #output_of, #pretty_generate, #provider, #provider_key, #resource, #resource_names, #resources, #template, #tf_module, #tf_safe, #var
Constructor Details
#initialize ⇒ RootContext
Returns a new instance of RootContext.
310 311 312 313 |
# File 'lib/terrafying/generator.rb', line 310 def initialize super @providers = {} end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(fn, *args) ⇒ Object
327 328 329 |
# File 'lib/terrafying/generator.rb', line 327 def method_missing(fn, *args) resource(fn, args.shift.to_s, args.first) end |
Instance Method Details
#backend(name, spec) ⇒ Object
315 316 317 318 319 320 321 |
# File 'lib/terrafying/generator.rb', line 315 def backend(name, spec) @output['terraform'] = { backend: { name => spec } } end |
#generate(&block) ⇒ Object
323 324 325 |
# File 'lib/terrafying/generator.rb', line 323 def generate(&block) instance_eval(&block) end |
#output_with_children ⇒ Object
331 332 333 334 335 336 337 338 339 |
# File 'lib/terrafying/generator.rb', line 331 def output_with_children PROVIDER_DEFAULTS.each do |name, spec| unless key_exists_spec_differs(provider_key(name, spec), name, spec) provider(name, spec) end end super end |