@dkkoval/react-tf
v0.3.0
Published
React renderer for Terraform with CLI support
Downloads
27
Readme
React Terraform Renderer
Write your Terraform configurations using React components, leveraging React's composition patterns and TypeScript's type safety.
Installation
npm install -g @dkkoval/react-tfCLI Usage
The react-tf CLI tool can process individual files or directories:
# Process current directory
react-tf
# Process specific directory
react-tf ./terraform
# Process specific file
react-tf ./terraform/main.tsx
# Process multiple files
react-tf ./terraform/main.tsx ./terraform/network.tsx
# Mix files and directories
react-tf ./terraform/main.tsx ./other-terraformLibrary Usage
Here's a basic example:
import { Terraform, Provider, Resource } from '@dkkoval/react-tf';
const Infrastructure = () => (
<Terraform>
<Provider
name="aws"
configuration={{
region: "us-west-2"
}}
/>
<Resource
type="aws_instance"
name="example"
attributes={{
ami: "ami-0c55b159cbfafe1f0",
instance_type: "t2.micro"
}}
/>
</Terraform>
);
export default Infrastructure;Examples
The examples directory contains several examples showcasing different features:
- Basic Usage - Simple provider and resource setup
- Advanced Configuration - Variables, multiple instances, and outputs
- React Patterns - Reusable components and composition patterns
Development
# Install dependencies
bun install
# Run tests
bun test
# Build package
bun run buildLicense
Apache License 2.0 - see LICENSE for details.
