All Tools View Categories About Contact Privacy

Terraform .gitignore Generator

Build a Terraform-tuned .gitignore (state, lock file, crash logs, overrides).

Runs entirely in your browser - nothing is uploaded and no cloud connection is made.
0
patterns
0
lines
Your generated .gitignore will appear here.

About Terraform .gitignore Generator

A good .gitignore keeps Terraform state, crash logs and provider directories out of version control, which protects secrets and prevents confusing merge conflicts. The Terraform .gitignore Generator assembles a Terraform-tuned ignore file from a set of toggles plus your own custom lines, so you get a correct file without memorising every pattern. It is the fast, reliable way to make sure a fresh repository starts with the right hygiene, and it removes the risk that a teammate commits something sensitive by accident on their very first push.

Terraform state files in particular can contain sensitive values such as resource attributes and, in older setups, plaintext secrets, which is why they must never be committed. State belongs in a remote backend such as an object store or Terraform Cloud, not in git. The generator also ignores the .terraform provider cache and the dependency lock file is intentionally kept tracked because it pins provider versions across machines. Crash logs and override files are ignored so local debugging artefacts do not leak into shared history. Everything is assembled in your browser, so you can build the file offline and nothing is uploaded. The result is plain text that drops straight into the root of your repository and is honoured by git immediately on the next commit.

Use this tool whenever you open a new Terraform project, fork a template, or onboard a teammate who is setting up a workspace for the first time. It also works well in documentation and workshops where you want attendees to leave with a correct ignore file. Because the pattern set is explicit and editable, you can explain each entry as you go, turning a boring config chore into a short, useful teaching moment about Terraform project hygiene. A small amount of prevention here avoids a painful later incident where a state file with embedded secrets is discovered deep in git history.

Features

  • Standard entries - state, lock file, crash logs, override files.
  • Provider cache - the .terraform directory is ignored by default.
  • State patterns - both *.tfstate and *.tfstate.* are covered.
  • Custom lines - append your own patterns under a Custom section.
  • Toggle driven - choose only what your project needs.
  • Live stats - see the pattern count and line count after building.
  • Word wrap toggle - wrap the preview for comfortable reading.
  • Copy / Download / Print - export the .gitignore wherever you need it.
  • Private - assembled locally, nothing leaves the page.
  • Sensible defaults - the dangerous entries start enabled.
  • Extensible - add tool specific lines like .terragrunt-cache.
  • Repeatable - the same toggles always yield the same file.
  • Portable - works offline with no dependencies.
  • Sectioned output - Custom patterns sit under their own heading.

How to Use

  1. Tick the entries you want ignored, starting with the defaults.
  2. Add custom lines if your project needs extra patterns.
  3. Click Generate .gitignore to build the file in the preview.
  4. Read the live stats to confirm the pattern and line counts.
  5. Toggle word wrap if a long custom line is clipped.
  6. Review the error panel if you selected nothing at all.
  7. Export with Copy, Download as .gitignore, or Print.
  8. Start over with Clear, or reload a realistic setup with Load sample.
  9. Commit the file at the repository root so git honours it.
  10. Share the pattern with teammates so every workspace matches.

Examples

Example - default set. With the defaults ticked the file ignores .terraform/, .terraform.lock.hcl, *.tfstate, *.tfstate.* and crash.log, which covers the most common and most dangerous artefacts for almost every Terraform project.

Example - custom secrets. Adding .env and secrets.tfvars under Custom appends them beneath a Custom heading, so local environment files never reach the shared repository even when a teammate forgets to mention them. This is the recommended guard for projects that keep local secrets outside the remote backend.

Example - Terragrunt. Enabling the .terragrunt-cache entry extends the file for teams that wrap Terraform with Terragrunt, keeping the generated cache out of git as well, while still tracking the actual configuration you author.

Benefits

  • Safe - keeps secrets and state out of git.
  • Standard - matches Terraform community conventions.
  • Flexible - add your own patterns easily.
  • Private - runs fully in the browser.
  • Clear - a stats row shows what you produced.
  • Teachable - each entry can be explained as you build.
  • Consistent - every repo starts from the same safe baseline.

Frequently Asked Questions

What does this tool generate?
It builds a .gitignore file with the standard Terraform entries: .terraform/, the dependency lock file, state files, crash logs and override files, plus any custom lines you add.
Should I ignore *.tfstate?
Yes. Terraform state can contain secrets and must never be committed; it belongs in a remote backend instead.
What about *.tfvars?
tfvars can hold real values, so it is offered but off by default; keep *.tfvars.example tracked.
Can I add custom lines?
Yes. Type one pattern per line in the custom box and it is appended under a Custom section.
Does this upload anything?
No. Everything is assembled in your browser and nothing leaves your machine.
Can I download the result?
Yes. Copy .gitignore, download it, or print it.