react-hcl (v0.2.2) is an experimental JSX/TSX-to-Terraform (.tf) transpiler that leverages a custom JSX runtime to convert React-like components directly into HCL, Terraform's configuration language. Unlike traditional Infrastructure as Code tools (e.g., Pulumi, CDKTF) which use actual programming languages to generate infrastructure, react-hcl translates JSX syntax at build time into pure Terraform files, enabling a declarative, component-based approach without any runtime overhead. It integrates with TypeScript (peer dep ^5), ships TypeScript definitions, and is intended for static compilation only—no runtime dependencies. Release cadence is experimental; breaking changes expected.
npm install react-hclNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows project setup with tsconfig for react-hcl JSX factory, a component using resource helper, and CLI compile command to generate Terraform HCL.
Update tsconfig.json `jsxFactory` to `jsx` or use `jsxImportSource`
Migrate to `jsx` by updating `jsxFactory` compiler option
Set `"jsxImportSource": "react-hcl"` in tsconfig and avoid importing React
Add `"jsxImportSource": "react-hcl"` to tsconfig.json or import { jsx } from 'react-hcl'Ensure tsconfig has `"jsx": "react-jsx"` and `"jsxImportSource": "react-hcl"`
Only import `jsxDev` from `'react-hcl/jsx-dev-runtime'` when using `"jsx": "react-jsxdev"`