TF

Terraform State & Modules

Remote state, locking, and reusable module design

Details

Language / Topic
terraformTerraform
Category
Infrastructure

Rules

balanced
- Store state exclusively in remote backends (e.g., S3 + DynamoDB locking) to prevent corruption.
- Write modular code: isolate reusable resources (like VPCs) into distinct remote modules.
- Always utilize a Remote State Backend. If using S3, you must configure a DynamoDB table for state-locking to prevent concurrent execution overwrites.
- Design reusable, generic Modules for standard components (like "Company standard EC2 instance") and invoke them strictly from distinct environments.
- Use explicit variable typing and validation blocks to prevent malformed runs from beginning execution.