terradart_core
Core runtime for terradart — a Dart-first authoring layer for Terraform that produces drop-in main.tf.json for the standard terraform CLI.
This package ships the small set of primitives every terradart Stack uses:
Stack— abstract base for your infrastructure module. You subclass it (final class MyStack extends Stack), registerResource/Datainstances viaadd(...)/addData(...), and callstack.writeTo('tf-out')from your ownmain()to emitmain.tf.json.Resource/Data— typed nodes supplied by curated factories interradart_google.TfArg.literal(...)/TfArg.ref(...)— the only two ways every settable field accepts input.TfArg<MyEnum>.literal(MyEnum.foo)encodes typed Dart enums (see below).LifecycleOptions—create_before_destroy,prevent_destroy,ignore_changes,replace_triggered_by.Stack.synth()returns an in-memorySynthResultwithtfJson(Terraform JSON map) and optionaldartConstants(typed Dart constants for the IaC ↔ application seam).Stack.writeTo(outDir)is the file-IO wrapper that callssynth()and writesmain.tf.json(plus anydartConstants) underoutDir.
This package is the runtime layer only. It is intentionally small and dependency-free. The companion packages are:
terradart_codegen— maintainerterradartCLI (wrap,wrap-init,wrap-promote) used to regenerate curated factories interradart_google.terradart_google— 256 curated GCP resource factories + 1 data source, plus generated schema carriers.
For project-level documentation, see the terradart repo README and terradart.dev.
Typed enum serialization
Hand-rolled and wrap-emitted enums implement TerraformEnum with a terraformValue getter. TfArgLiteral.toTfJson() encodes them to Terraform strings; missing conventions throw ArgumentError at synth time.
enum RoutingMode implements TerraformEnum {
regional('REGIONAL'),
global('GLOBAL');
const RoutingMode(this.terraformValue);
@override
final String terraformValue;
}
Installation
dependencies:
terradart_core: ^0.21.x
Check pub.dev for the latest patch. Read MIGRATING.md before minor bumps.
Libraries
- terradart_core
- terradart — Dart-first IaC runtime.