Module: Pangea::TemplateHelpers
- Defined in:
- lib/pangea/architecture.rb
Overview
Helper methods made available inside architecture blocks. Mixed into TerraformSynthesizer at load time so the DSL can call things like “jsonencode(…)“ and “managed_tags“ without caller-side wiring. These are deliberately simple and free of side effects —they return plain Ruby values the synthesizer can serialise.
Instance Method Summary collapse
-
#jsonencode(value) ⇒ Object
Serialise a Ruby hash/array to a JSON string.
-
#managed_tags ⇒ Object
Canonical tag set applied to every Pangea-managed resource.
Instance Method Details
#jsonencode(value) ⇒ Object
Serialise a Ruby hash/array to a JSON string. Matches the shape Terraform’s “jsonencode(…)“ function produces; callers using “jsonencode({ Statement: […] })“ get a string embedded into the resource body, which Terraform then consumes verbatim.
71 72 73 |
# File 'lib/pangea/architecture.rb', line 71 def jsonencode(value) JSON.generate(value) end |
#managed_tags ⇒ Object
Canonical tag set applied to every Pangea-managed resource. Consumers that want to extend (e.g. add team, cost-center, environment) can “merge“ their own hash on top.
78 79 80 81 82 83 |
# File 'lib/pangea/architecture.rb', line 78 def { ManagedBy: 'pangea', Namespace: ENV.fetch('PANGEA_NAMESPACE', 'default'), } end |