Skip to main content
InterviewHubPRO
Section Overview
Q6

Question 6 of 50

Part 1: Terraform Core Architecture, HCL & Providers (1 - 15)

12%
Terraform & IaC (50 Qs)•Part 1: Terraform Core Architecture, HCL & Providers (1 - 15)

What is the Terraform State File (`terraform.tfstate`), and why is it essential?

senior LevelFormsCI/CD & DevOpsSystem Design

In Simple Words: Terraform must map real-world cloud resources to the resources declared in your HCL code.

The State File stores this mapping:

  • Maps aws_instance.web to AWS resource ID i-08a9f2123b.
  • Tracks resource metadata, dependencies, and cached attributes (private IPs, ARNs).
  • Enhances performance by caching resource attributes instead of querying hundreds of cloud APIs on every run.