7 Essential Best Practices For Working With Terraform

⚗ Kevin Summersill 🔋
2 min readFeb 12, 2023

Terraform is an unbelievably powerful and efficient tool for managing infrastructure as code. However, with great power comes great responsibility. To get the most out of Terraform, there are certain best practices every user should follow.

1. Understand the Destroy Command

The Terraform destroy command can reverse almost any operation Terraform has performed when applied to an existing environment. It is essential that your Terraform scripts are configured such that running the destroy command, either intentionally or accidentally, will not unintentionally cause disruption or damage to your environment.

2. Use Terraform Version Control

Running Terraform scripts directly against production environments can be risky. It is recommended that you use version control on all of your Terraform scripts. Version control will also provide you with an opportunity to review every change before applying it, as well as undo past changes as needed.

3. Pre-Check with Terraform Plan

Before applying any changes, you should pre-check them with the terraform plan command. This will list the changes that Terraform intends to make, allowing you to review them beforehand. If any unintended changes are listed, you can deny the plan before any changes…

--

--

⚗ Kevin Summersill 🔋

Enterprise Solution Architect | Certified K8s Administrator/Developer ⚓ | SAFe SPC | Cert Terraform | AWS Solutions Architect | Dev*Ops/GitOps Engineer 🔥