All Tools View Categories About Contact Privacy

Terraform terraform Block Generator

Build a Terraform terraform settings block (HCL) for versions.tf.

Runs entirely in your browser - nothing is uploaded and no cloud connection is made.
Your generated terraform block will appear here.

About Terraform terraform Block Generator

The terraform settings block configures Terraform itself rather than any single provider or resource. The Terraform terraform Block Generator writes one valid terraform block from a simple form, so you can scaffold a versions.tf without memorizing the exact nesting. You can set an optional required_version constraint that pins the Terraform CLI range your configuration expects, declare a required_providers block that fixes each provider source and version, and describe an optional backend with its own key value settings. The result is real HCL built with the shared serializer, ready to drop into a project.

Everything runs locally in your browser: nothing is uploaded, no provider is fetched, and no cloud connection is made. The generator is ideal for bootstrapping a new module, standardizing the settings block across repositories, or teaching the terraform block structure without opening the documentation. Because the output is plain HCL, you stay in full control of the final file. Unlike a wizard that hides details, this tool shows you the exact block it produced so you can learn the format and adapt it later by hand.

The required_version field accepts any constraint operator Terraform supports, from a single pinned version to a range such as >= 1.5.0, < 2.0.0. The required_providers block is where most real projects live, because it pins provider sources (so terraform init knows where to download) and versions (so behavior stays reproducible). The backend section is optional but powerful: choosing s3, gcs, azurerm, local, remote, or consul and supplying its settings produces the same configuration you would otherwise copy from docs and risk typo in.

Pinning these values matters because unpinned configurations drift between machines and between teammates, producing the classic it worked on my laptop failure. A committed versions.tf makes the Terraform and provider versions explicit, so a CI runner and a local workstation produce identical plans. The generator lowers the friction of creating that file, which means teams are more likely to actually keep it in version control.

Features

  • required_version - an optional version constraint such as >= 1.5.0 or a full range.
  • required_providers - add as many entries as you need, each with a name, source and version.
  • backend - any backend type (s3, gcs, azurerm, local, remote, consul, and more) with arbitrary key value settings.
  • backend label - supply an optional label for state separation when a backend supports named workspaces.
  • value types - backend settings support string, number, bool and raw literals so booleans and numbers are emitted correctly.
  • Dynamic rows - add or remove provider and backend setting rows without editing code.
  • Live stats - a summary row shows the provider count and backend setting count.
  • Copy / Download / Print - get versions.tf wherever you need it.

How to Use

  1. Set required_version if you want to constrain the Terraform CLI; leave it blank to omit the field entirely.
  2. Add required_providers entries using the Add provider button, filling name, source and an optional version for each.
  3. Add a backend by entering its type and an optional label, then adding key value settings with the right type.
  4. Generate the HCL and review the output in the preview pane, checking the stats row for counts.
  5. Fix any validation message, such as a provider row left without a name.
  6. Copy, download or print the generated versions.tf for your project.
  7. Commit the file to version control so every teammate and CI runner uses the same pinned versions.

Examples

Example 1: required_version >= 1.5.0, one required provider aws with source hashicorp/aws and version ~> 5.0, and an s3 backend with bucket and region settings, produces a complete terraform block ready for a remote state. Example 2: two required providers (aws and random) with no backend produces a block that only pins providers, which is common for shared modules that should not choose a backend for their callers. Example 3: a local backend with path setting emits a minimal block ideal for development and quick experiments on a laptop. Example 4: a remote backend with hostname and organization settings creates a Terraform Cloud or Enterprise block without manual editing, and the stats row reports the two backend settings you supplied.

Benefits

  • Correct schema - the output is a valid terraform block with correct nesting and value types.
  • Flexible - mix providers and backends however your project needs them.
  • Consistent - standardize the settings block across many repositories and teams with one tool.
  • Educational - the generated HCL is readable, so it doubles as a learning aid for new users.
  • Private - everything runs in the browser, no upload, no network, no credentials.
  • Portable - copy, download or print the file where you need it.

Frequently Asked Questions

What does this tool generate?
It writes one terraform settings block with optional required_version, a required_providers block, and an optional backend block.
What goes in required_providers?
For each provider, a local name, source (e.g. hashicorp/aws) and an optional version constraint.
Which backends are supported?
Any: s3, gcs, azurerm, local, remote, consul, and others via key/value settings.
Does this connect to a cloud?
No. Everything is assembled in your browser and nothing is uploaded.
Can I download it?
Yes. Copy the HCL, download versions.tf, or print it.