Skip to main content

Terraform Variable Schema Generator

Paste a JSON object and instantly generate a complete variables.tf with inferred Terraform types (string, number, bool, list, map) plus a matching terraform.tfvars. Override types and descriptions before copying.

✓ Auto-infers HCL types ✓ variables.tf + terraform.tfvars ✓ Override types per variable ✓ No upload, runs in browser

Frequently Asked Questions

What is the difference between variables.tf and terraform.tfvars?▼

variables.tf declares the variable schema — names, types, descriptions, and optional defaults. It tells Terraform what variables exist and what shape they must have. terraform.tfvars provides the actual values for those variables. Separating them is best practice: commit variables.tf to version control (it contains no secrets), and keep terraform.tfvars out of git (it may contain sensitive values). You can also use .tfvars.json for JSON-format variable values, or pass values via TF_VAR_name environment variables.

How does this tool differ from a form-based Terraform variable generator?▼

This tool takes a JSON object as input and automatically infers the correct Terraform types — string, number, bool, list, or map — from the JSON structure. You paste your existing configuration JSON (from an API response, environment config, or JSON Schema example) and immediately get a complete variables.tf with proper HCL type constraints, plus a matching terraform.tfvars with the actual values. This is faster than filling in a form field-by-field when you already have data in JSON format.

What Terraform types are supported and how are they inferred?▼

The tool infers: string (JSON strings), number (JSON numbers), bool (JSON booleans), list(string) (JSON arrays of strings), list(number) (JSON arrays of numbers), and map(string) (JSON objects with key-value pairs). For complex nested objects, it defaults to map(string) — you can override the type in the UI before copying. Terraform also supports object({ attr = type }) and tuple types for strict structural typing, which you'd add manually for complex nested schemas.

Should I commit terraform.tfvars to version control?▼

Generally no — terraform.tfvars often contains sensitive values like database passwords, API keys, and access tokens. Add *.tfvars to .gitignore. Use terraform.tfvars.example (committed) to document what values are needed, and the actual terraform.tfvars (gitignored) for real values. For CI/CD, inject variable values via TF_VAR_name environment variables or use a secrets manager like HashiCorp Vault, AWS Secrets Manager, or GitHub Actions secrets.

Share this tool: X / Twitter LinkedIn
✓ 60,000+ developers use DevPlaybook ★★★★★ 4.8 / 5 on Gumroad ✓ MIT licensed · Instant download ✓ No login required

Related Products

on Gumroad

You Might Also Need

More Free Tools

Enjoying this tool? Get more like it.

Weekly developer tool guides, productivity playbooks & AI tricks. Free. No spam.

DevPlaybook Pro 7 days free

Unlock AI-Powered Dev Tools

  • ⚡ AI Code Review, Doc Generator & SQL Builder
  • ⚡ All premium templates & early access
  • ⚡ Member discounts on Gumroad products
Start Free Trial →

$9/mo after trial · Cancel anytime

Want the full toolkit?

Get DevPlaybook Pro

Every template, guide, boilerplate, and automation script in one bundle. 13 premium products — grab them all at once and save big.

$79
$241 separately Save $162 (67% off)
Get DevPlaybook Pro — $79 →

MIT licensed · Instant download · No subscription

See what's included → Browse all deals →