What are the different files used by Terraform?

Published on 04 Sep 2025 by Adam Lloyd-Jones

Terraform uses various files to define, manage, and track your infrastructure. These files include configuration files, state files, and other supporting files, each serving a specific purpose in the Terraform workflow.

Here’s a breakdown of the files used by Terraform:

In essence, Terraform relies on a well-defined ecosystem of files to translate your infrastructure desires into actual cloud resources, much like a chef uses a recipe, ingredient lists, and a pantry inventory to prepare a meal. The .tf files are the recipe, the .tfvars files are the ingredient lists, and the .tfstate file is the real-time inventory of what’s cooking.

Terraform leverages a structured approach to defining infrastructure through a set of distinct file types, with main.tf, variables.tf, outputs.tf, and providers.tf being among the most fundamental configuration files. While Terraform processes all files with a .tf extension in the working directory, these naming conventions are widely adopted for clarity and organization within a project. Terraform code can also be written in pure JSON in files with the .tf.json extension.

Here’s a detailed look at the functions of these core files:

These files collectively form the backbone of a Terraform project, enabling you to declaratively define, configure, and manage your infrastructure efficiently and systematically.

Related Posts

Adam Lloyd-Jones

Adam Lloyd-Jones

Adam is a privacy-first SaaS builder, technical educator, and automation strategist. He leads modular infrastructure projects across AWS, Azure, and GCP, blending deep cloud expertise with ethical marketing and content strategy.

comments powered by Disqus

Copyright 2025. All rights reserved.