← Back to all products

Terraform Starter

$29

Production-ready Terraform modules for cloud infrastructure with state management.

📁 9 files
JSONMarkdownPythonTerraformAWS

📄 Product Preview

Try the interactive reader and demo tools below, or get the full product with all content unlocked.

📖 Interactive Reader (Free Preview) ⚙ Try Demo Tools 📦 Download Free Sample

📁 File Structure 9 files

terraform-starter/ ├── LICENSE ├── README.md ├── examples/ │ └── infra_spec.json ├── free-sample.zip ├── guide/ │ ├── 01_features.md │ ├── 02_configuration-reference.md │ └── 03_generated-files.md ├── index.html └── src/ └── terraform_generator.py

📖 Documentation Preview README excerpt

Terraform Starter

Part of the Deploy Kit by CodeVault

Scaffold production-ready Terraform configurations from a simple JSON infrastructure spec. Generates provider setup, VPC networking, compute instances, databases, and S3-compatible storage — all with best-practice module structure.

Features

  • Generate Terraform configs for AWS-style infrastructure (provider-agnostic patterns)
  • Scaffolds complete module structure: main.tf, variables.tf, outputs.tf, terraform.tfvars
  • VPC/networking with public and private subnets
  • Compute instances with configurable size and count
  • RDS-style database resources with secure defaults
  • S3-compatible storage buckets with versioning and encryption
  • Environment-specific tfvars files (dev, staging, production)
  • Remote state backend configuration
  • Validates your infrastructure spec before generating
  • Python stdlib only — zero dependencies

Quick Start


# Generate Terraform configs from the example spec
python src/terraform_generator.py --config examples/infra_spec.json

# Write to a target directory
python src/terraform_generator.py --config examples/infra_spec.json --output-dir ./terraform/

# Generate only specific components
python src/terraform_generator.py --config examples/infra_spec.json --components vpc,compute

# Validate config without generating
python src/terraform_generator.py --config examples/infra_spec.json --validate-only

Configuration Reference

Create a JSON file with these fields:

FieldTypeRequiredDescription
project_namestringYesProject name (used in resource naming)
regionstringNoCloud region (default: us-east-1)
providerstringNoCloud provider: aws (default: aws)
environmentsarrayNoEnvironments to generate tfvars for
vpcobjectNoVPC config: cidr, public_subnets, private_subnets
computeobjectNoCompute config: instance_type, count, ami
databaseobjectNoDB config: engine, instance_class, allocated_storage
storageobjectNoS3 config: bucket_name, versioning, encryption
state_backendobjectNoRemote state: bucket, key, dynamodb_table
tagsobjectNoDefault tags applied to all resources

CLI Reference

FlagDescription
--config, -cPath to the JSON infrastructure spec (required)
--output-dir, -oDirectory to write Terraform files (default: stdout preview)
--componentsComma-separated list of components to generate
--validate-onlyOnly validate config, don't generate

... continues with setup instructions, usage examples, and more.

📄 Code Sample .py preview

src/terraform_generator.py #!/usr/bin/env python3 """ Terraform Config Generator — Deploy Kit by DataNest Scaffold production-ready Terraform configurations from a JSON infrastructure specification. Generates provider setup, VPC networking, compute instances, databases, and S3-compatible storage with best-practice module structure. Why this exists: Starting a Terraform project from scratch means writing dozens of boilerplate HCL files, remembering all the required provider arguments, and setting up remote state. This tool scaffolds all of it from a single JSON spec, with sensible defaults and extensive comments explaining every resource block. Usage: python terraform_generator.py --config infra.json python terraform_generator.py --config infra.json --output-dir ./terraform/ python terraform_generator.py --config infra.json --components vpc,compute License: MIT """ from __future__ import annotations import argparse import json import logging import sys from dataclasses import dataclass, field from pathlib import Path from typing import Any # --------------------------------------------------------------------------- # Constants # --------------------------------------------------------------------------- VALID_COMPONENTS = {"vpc", "compute", "database", "storage"} VALID_DB_ENGINES = {"postgres", "mysql", "mariadb"} LOG = logging.getLogger("terraform-generator") # --------------------------------------------------------------------------- # Data Models # --------------------------------------------------------------------------- @dataclass class VpcConfig: """VPC/networking configuration.""" # ... 837 more lines ...
Buy Now — $29 Back to Products