.tf

How to open a .tf file

Quick, free ways to open Terraform on any system.

A .tf file is a Terraform Configuration File. If double-clicking does nothing, your computer simply does not have an app that reads Terraform yet. Here is how to fix that on each operating system, using free software wherever possible.

Open a .tf file step by step

  1. Confirm the file really is a .tf. Drop it into the WhatFileType file identifier, which reads its signature without uploading anything.
  2. On Windows, open it with VS Code (HashiCorp Terraform) or any text editor.
  3. On Mac, use VS Code (HashiCorp Terraform) or any text editor.
  4. On Linux, try VS Code (HashiCorp Terraform) or any text editor.
  5. Still stuck? Convert the .tf to json (HCL JSON syntax), which opens more widely.

Best apps to open .tf files

Windows

  • VS Code (HashiCorp Terraform)
  • any text editor

macOS

  • VS Code (HashiCorp Terraform)
  • any text editor

Linux

  • VS Code (HashiCorp Terraform)
  • any text editor
!
Before you open it: Caution. The file itself is declarative text, but applying it creates, changes or destroys real (often billed) infrastructure. Always review terraform plan output before apply.

Frequently asked questions

Why can't I open my .tf file?

Almost always because no installed app understands Terraform. Install one of the apps above, or convert the file to a format your existing software already reads.

How do I open a .tf file?

Any text editor; VS Code with the official HashiCorp Terraform extension adds validation and completion. Running it requires the terraform CLI (or OpenTofu).

What is the difference between .tf and .tfvars?

.tf files declare the resources and variables; .tfvars files supply the concrete values for those variables per environment, like region or instance size.

Learn more about .tf