Cloud Tech
Tool

Terraform Variable Generator

Build a variables.tf from a list of name/type/description/default rows, runs entirely in your browser.

Updated Jul 26, 2026Victor Nwoke
Variable 1

About this tool

Add one or more variables, each with a name, a Terraform type (string, number, bool, list(string), or map(string)), an optional description, and an optional default, and get back a correctly formatted variables.tf with one variable block per row. Defaults are formatted for their type automatically: a list(string) default is entered as a comma-separated list and rendered as a proper HCL list literal, a map(string) default as comma-separated key=value pairs rendered as a proper HCL map.

Leaving a default blank is meaningful, not just empty: a Terraform variable with no default becomes required, and Terraform will prompt for (or fail without) a value at apply time. This tool only emits a default line when one is actually given, so a variable you leave blank stays genuinely required rather than silently getting an empty-string default.

Frequently asked questions

What happens if I leave the default blank?
The generated block has no default line at all, which is what makes a Terraform variable required. Terraform will refuse to plan or apply without a value being supplied some other way (a .tfvars file, -var flag, or interactive prompt).
How do I write a default for a list(string) or map(string) variable?
For list(string), enter comma-separated values, e.g. "us-east-1a, us-east-1b". For map(string), enter comma-separated key=value pairs, e.g. "env=prod, team=platform". Both are converted into properly quoted HCL literals.
Does this validate that my variable names are legal Terraform identifiers?
Yes. A name must start with a letter or underscore and contain only letters, numbers, underscores, and hyphens, the same rule Terraform itself enforces; an invalid name is rejected with an error before any output is generated.
Is my input sent anywhere?
No. The file is assembled entirely in your browser, no network request is made.
ShareXLinkedInReddit
Was this page helpful?
Suggest an improvement