Class: Pangea::CLI::Synthesizer
Overview
Synthesizes a Pangea Ruby template into Terraform JSON. Loads the template, evaluates it on a TerraformSynthesizer, injects the backend config, and returns the manifest.
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
-
#initialize(config) ⇒ Synthesizer
constructor
A new instance of Synthesizer.
-
#synthesize ⇒ Hash
Normalized Terraform manifest with string keys.
Constructor Details
#initialize(config) ⇒ Synthesizer
Returns a new instance of Synthesizer.
13 14 15 |
# File 'lib/pangea/cli/synthesizer.rb', line 13 def initialize(config) @config = config end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
11 12 13 |
# File 'lib/pangea/cli/synthesizer.rb', line 11 def config @config end |
Instance Method Details
#synthesize ⇒ Hash
Returns Normalized Terraform manifest with string keys.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/pangea/cli/synthesizer.rb', line 18 def synthesize load_workspace_libs load_synthesizer_gem synth = TerraformSynthesizer.new block = capture_template_block(config.template_content, config.template_file) if block synth.instance_eval(&block) else $stderr.puts "[pangea] Warning: no template block found, trying direct eval" synth.instance_eval(config.template_content, config.template_file) end manifest = normalize(synth.synthesis) inject_backend(manifest) manifest end |