Skip to content

react-hclRender Terraform HCL from TSX.

A TSX authoring layer for rendering Terraform configuration.

Why react-hcl?

CDK-style tools often model infrastructure through imperative construction APIs. react-hcl treats Terraform configuration as a render target instead.

For example, this TSX:

tsx
import { Resource } from "react-hcl";

export default (
  <Resource
    type="aws_s3_bucket"
    label="assets"
    bucket="my-assets"
  />
);

Generates this HCL:

hcl
resource "aws_s3_bucket" "assets" {
  bucket = "my-assets"
}

Start Here

  • Getting Started walks through installation, init, generation, and Terraform validation.
  • Concepts explains how components, refs, expressions, and output order work.