App
TheApp class is the root of your tfts application. It manages the lifecycle of your infrastructure definition and serves as the entry point for synthesis.
app.synth(), tfts traverses the construct tree and generates the corresponding Terraform JSON configuration for each stack.
TerraformStack
ATerraformStack represents a single unit of deployment. In Terraform terms, one stack corresponds to one state file. Stacks are children of the App.
Construct
Construct is the base class for all building blocks in tfts. Every resource, module, or higher-level abstraction inherits from Construct.
Each construct has a node property of type Node, which provides access to the tree structure and metadata.
Node
TheNode manages:
- Tree Hierarchy: Parent-child relationships between constructs.
- Context: Shared data passed down the tree.
- Metadata: Information about the construct (e.g., warnings, errors).
- Validation: Logic to ensure the construct is correctly configured before synthesis.
Construct Tree Hierarchy
Constructs are organized in a tree. TheApp is the root, Stacks are its children, and Resources are children of Stacks.
Synthesis Process
Synthesis is the process of converting your TypeScript code into Terraform JSON.- App.synth(): Initiates the process.
- Validation: tfts runs validation logic on all constructs in the tree.
- Stack.toTerraform(): Each stack generates its own Terraform configuration.
- JSON Generation: The final output is written as
.tf.jsonfiles, which Terraform can execute.