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_safe, #var
Constructor Details
#initialize ⇒ RootContext
Returns a new instance of RootContext.
300 301 302 303 |
# File 'lib/terrafying/generator.rb', line 300 def initialize super @providers = {} end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(fn, *args) ⇒ Object
317 318 319 |
# File 'lib/terrafying/generator.rb', line 317 def method_missing(fn, *args) resource(fn, args.shift.to_s, args.first) end |
Instance Method Details
#backend(name, spec) ⇒ Object
305 306 307 308 309 310 311 |
# File 'lib/terrafying/generator.rb', line 305 def backend(name, spec) @output['terraform'] = { backend: { name => spec } } end |
#generate(&block) ⇒ Object
313 314 315 |
# File 'lib/terrafying/generator.rb', line 313 def generate(&block) instance_eval(&block) end |
#output_with_children ⇒ Object
321 322 323 324 325 326 327 328 329 |
# File 'lib/terrafying/generator.rb', line 321 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 |