terradart_core library

terradart — Dart-first IaC runtime.

Classes

AppExport
IaC ↔ application seam: a value Stack can export to either pure-Dart constants or Terraform output blocks (or both).
AttributeRef<T>
Public for sealed pattern matching, but constructor is private — only TfRef.attribute() may construct instances.
DartConstantsEmitter
Renders a list of DartConstantSpecs as a generated Dart source file suitable for writing to <stack>.app.dart.
DartConstantSpec
Spec for a single Dart constant in the generated app_exports.g.dart file.
Data
Base of every user-instantiable Terraform data block.
DataRef<T>
Public for sealed pattern matching, but constructor is private — only TfRef.data() may construct instances.
DependencyTarget
A depends_on entry. Sealed so synth can dispatch on the two cases: "depend on entire resource" vs "depend on a specific ref/attribute".
EnvBackedExport
Export resolved at Dart compile time from --dart-define / environment variable. Never appears in Terraform outputs.
GcsBackend
terraform { backend "gcs" { ... } } configuration.
LifecycleOptions
lifecycle { ... } block on a resource.
LiteralResolver
Pass-1 product: every literal value supplied to any resource/data source in a Stack, indexed by (tfAddress, attrName) where attrName is the snake_case Terraform attribute name (matching what TfRef.attribute references).
LocalBackend
terraform { backend "local" { ... } } configuration.
ModuleCall
A module "<localName>" { ... } call as a Dart value.
OutputEmissionResult
Result of Pass 2: separate lists of Dart constants and Terraform outputs.
OutputEmitter
Pass 2: walks stack.appExports, classifies each as Dart-only, Dart + Terraform output, or Terraform-output-only based on the literal resolver and the export's flags.
RefDependency
Resource
Base of every user-instantiable Terraform resource.
ResourceAttributeExport<T>
Generic resource-attribute export. Caller supplies the Dart type name and an encoder that turns a resolved literal value into a Dart expression.
ResourceDependency
ResourceIdExport
Export a resource attribute reference (typically name / id of a resource) as either a Dart constant (when literal-resolvable at synth time) or a Terraform output block (when computed).
ResourceRef
Public for sealed pattern matching, but constructor is private — only TfRef.resource() may construct instances.
S3Backend
terraform { backend "s3" { ... } } configuration.
Stack
User-extended IaC composition root.
StackBackend
Lightweight backend hook. Core ships GcsBackend, S3Backend, and LocalBackend; anything else implements this interface in the caller. The Stack only stores the value and exposes a discriminator for synth's terraform { backend ... } emitter.
StackProvider
Coordination interface between Stack (in this package) and concrete providers (e.g. GoogleProvider in terradart_google). Concrete providers implement every getter using their baked-in constants from Stage 2 codegen.
StringExport
Static literal string known at synth time.
SynthResult
Bundle returned by StackSynth.synth.
TerraformEnum
Implemented by every codegen-emitted Dart enum whose values map to Terraform string literals (e.g. KmsKeyPurpose.encryptDecrypt'ENCRYPT_DECRYPT').
TerraformOutputSpec
Spec for a single Terraform output block.
TfAddressed
Anything that exposes a Terraform address, e.g. google_pubsub_topic.orders.
TfArg<T>
A Terraform argument: either a Dart-side literal or a Terraform-side reference.
TfArgExpression<T>
A raw Terraform expression — the tf.json template string, verbatim.
TfArgLiteral<T>
TfArgRef<T>
TfArgVariable<T>
TfJsonEncoder
Synth-time JSON encoder: builds the JSON structure for main.tf.json.
TfMoved
One moved { from = ... to = ... } block: the state object at from now belongs to the resource at to, so a rename does not become a destroy-and-create.
TfRef<T>
A Terraform-side reference (attribute, data source, var, local, ...).
TfTimeouts
timeouts { ... } on a resource or data source: how long Terraform waits for each operation before giving up.
TfVariable
One variable "<name>" { ... } declaration.

Enums

ResourceKind
Whether a Stack entry is a resource block or a data block in Terraform JSON.

Extensions

TerraformDurationExt on Duration
Converts a Dart Duration into a Terraform duration string ("604800s").

Functions

hasTemplateSequence(String template) bool
True when template holds at least one unescaped ${ ... } or %{ ... } sequence — Terraform evaluates it; a string without one is a plain value ($${ and %%{ are the escaped, literal forms).
templateVariableNames(String template) Set<String>
The names of the var.<name> references inside the sequences of template, in order of first appearance. $${ / %%{ escapes are literal text and the contents of quoted strings inside a sequence are ignored, except for sequences nested in them ("${lower("${var.x}")}").

Exceptions / Errors

DuplicateModuleError
A ModuleCall registered twice under one name.
DuplicateResourceError
Thrown by Stack.add / Stack.addData when an entry with the same (kind, terraformType, localName) triple is registered twice.
SensitiveLiteralError
Thrown by TfJsonEncoder.encodeArgMapWithSensitive when a TfArgLiteral is assigned to a sensitive field — Terraform would otherwise reject the resulting apply because v0.x masking left the emitted value as empty string (e.g. Missing user password, Field [payload] is required).