TfJsonEncoder class

Synth-time JSON encoder: builds the JSON structure for main.tf.json.

Each public static returns a JSON-serialisable Dart value (no TfArg / TfRef instances escape — they're collapsed to strings or scalars). The orchestrator in stack_synth.dart glues these together into the top-level map.

Constructors

TfJsonEncoder()

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

blockProvider(Resource r) → String?
The block's provider meta-argument: its Resource.provider, else its Resource.defaultProvider when that is not the type's implied prefix provider, else null.
dataGroup(Stack stack) → Map<String, dynamic>?
Top-level data { ... } group. A data source carries its provider and timeouts meta-arguments like a resource; it has no lifecycle / depends_on / sensitive masking at v0.0.x — Terraform rejects lifecycle on data blocks anyway.
dependsOn(List<TfAddressed> deps) → List<String>?
depends_on = [...] list of bare addresses, or null when empty.
encodeArg(TfArg arg) → Object?
Encode a single TfArg into a JSON-serialisable value.
encodeArgMap(Map<String, TfArg?> argMap) → Map<String, Object?>
Encode a full argMap; drops keys whose value is null (optional unset fields) or whose literal payload encodes to null.
encodeBareAddress(TfRef ref) → String
For positions where Terraform expects a bare resource address (no ${...} interpolation): replace_triggered_by, depends_on. Delegates to TfRef.bareAddress.
lifecycleBlock(LifecycleOptions opts) → Map<String, dynamic>?
lifecycle { ... } nested block, or null when no fields are set.
moduleGroup(Stack stack) → Map<String, dynamic>?
Top-level module { ... } group, keyed by the call's local name: source (and version) first, then the module's inputs, then the meta-arguments. Returns null when the stack registers no call.
movedBlock(Stack stack) → List<Map<String, String>>?
Top-level moved list — one {"from": ..., "to": ...} object per Stack.addMoved entry, in registration order — or null when the stack recorded none.
providerBlock(Stack stack) → Map<String, dynamic>?
The top-level provider { ... } value, or null when no block is needed.
providerReference(StackProvider p) → String
google or google.eu: the value a resource's provider meta-argument uses to select p.
replaceTriggerAddress(ReplaceTrigger trigger) → String
The bare address replace_triggered_by lists for trigger: a resource's address or an attribute reference's.
resourceBlock(Resource r, {bool devModeInjectDeletionProtection = false}) → Map<String, dynamic>
JSON for one resource block: argMap + optional depends_on + optional lifecycle + optional timeouts.
resourcesGroup(Stack stack) → Map<String, dynamic>?
Top-level resource { ... } group, keyed by terraform type then local name. Returns null when the stack has no resources.
terraformBlock(Stack stack) → Map<String, dynamic>
The top-level terraform { ... } block: required_version, required_providers, optional backend.
variableBlock(Stack stack) → Map<String, dynamic>?
The top-level variable { ... } value, or null when the stack declares none (Terraform rejects an empty variable block).

Constants

defaultRequiredVersion → const String
>= 1.11.0 is the default required Terraform version because curated factories (notably Secret Manager's secret_data_wo) depend on Terraform 1.11+ write-only arguments. Override via Stack(requiredVersion: ...) if your stack does not need them.