Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Terraform
  3. tfvar

tfvar

MITGov0.11.0

A CLI tool that scans Terraform configurations and generates variable definition templates in multiple formats.

Visit WebsiteGitHubGitHub
231 stars24 forks0 contributors

What is tfvar?

tfvar is a Terraform variable definitions template generator. It scans Terraform configurations or modules, extracts declared input variables, and produces templates in formats like .tfvars, environment variables, or Terraform Enterprise resources. It solves the problem of manually creating and maintaining variable definition files, especially in complex modules with many inputs.

Target Audience

Terraform users and DevOps engineers who work with multiple Terraform modules or need to consistently populate variable values across different environments.

Value Proposition

Developers choose tfvar because it automates a repetitive and error-prone task, supports multiple output formats for different workflows (local, CI/CD, Terraform Cloud/Enterprise), and integrates seamlessly with Terraform's existing variable precedence system.

Overview

Terraform's variable definitions template generator.

Use Cases

Best For

  • Generating initial .tfvars files for a new Terraform module
  • Converting Terraform variables to environment variables for CI/CD pipelines
  • Creating Terraform Enterprise (tfe) variable resources from existing modules
  • Preparing variable payloads for Terraform Cloud's Workspace Variables API
  • Auditing all required inputs for a complex Terraform configuration
  • Automating variable population from existing tfvars files and environment variables

Not Ideal For

  • Teams managing Terraform exclusively through Terraform Cloud's web UI without CLI integration
  • Projects with monolithic, single-file Terraform configurations that have fewer than five input variables
  • Environments requiring dynamic variable generation from external APIs or databases at runtime
  • Organizations using multiple IaC tools like Pulumi or CloudFormation alongside Terraform

Pros & Cons

Pros

Flexible Output Formats

Generates templates in .tfvars, environment variable exports, Terraform Enterprise resources, and Terraform Cloud API payloads, catering to diverse deployment workflows as shown in the README examples.

Seamless Terraform Integration

Mirrors Terraform's variable precedence with --var and --var-file flags, ensuring consistency with existing CLI practices and reducing learning curve.

Automated Value Population

The --auto-assign option pulls values from terraform.tfvars and environment variables, streamlining setup by minimizing manual entry errors.

Customizable Default Handling

Offers --ignore-default to exclude variable defaults, allowing for clean templates when defaults are not desired, as demonstrated in the usage examples.

Cons

Limited Scope

Only extracts input variables and ignores outputs, providers, or other Terraform elements, necessitating additional tools for full module documentation.

No Built-in Validation

Does not validate variable types or values against Terraform schemas, which could lead to runtime errors if incorrect values are used without proper checks.

Terraform-Exclusive Utility

Useful only for Terraform projects, with no support for other infrastructure-as-code platforms, limiting its applicability in mixed environments.

Frequently Asked Questions

Quick Stats

Stars231
Forks24
Contributors0
Open Issues3
Last commit6 months ago
CreatedSince 2020

Tags

#devops#cli-tool#hcl#terraform#infrastructure-as-code#golang#cli#configuration-management#go#automation#terraform-configurations

Built With

G
Go

Links & Resources

Website

Included in

Terraform6.3k
Auto-fetched 10 hours ago

Related Projects

terraformerterraformer

CLI tool to generate terraform files from existing infrastructure (reverse Terraform). Infrastructure to Code

Stars14,557
Forks1,837
Last commit5 months ago
InfracostInfracost

Cloud cost intelligence for engineers, AI coding agents, and CI/CD 💰📉 Shift FinOps Left!

Stars12,509
Forks686
Last commit6 days ago
TerragruntTerragrunt

Terragrunt is a flexible orchestration tool that allows Infrastructure as Code written in OpenTofu/Terraform to scale.

Stars9,819
Forks1,222
Last commit15 hours ago
atlantisatlantis

Terraform Pull Request Automation

Stars9,281
Forks1,335
Last commit13 hours ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub