Terraform Best Practices
Terraform & OpenTofu best practices to help you build infrastructure as code to automatically manage, configure, provision, deploy, and monitor your organization's IT infrastructure using software and code.
- Terraform & OpenTofu Tutorials
Estimate AWS Costs in Terraform Pull Requests with Infracost
How to see the monthly cost of Terraform and OpenTofu changes before applying them with Infracost, and how to keep AWS demo costs under control.
- Terraform & OpenTofu Tutorials
Terraform and OpenTofu Testing: tofu test, validate and Terratest
How to test infrastructure code: terraform validate, the native terraform test and tofu test framework with mock providers, plan checks and Terratest.
- Terraform & OpenTofu Tutorials
Terraform and OpenTofu Project Structure: Recommended Layouts
How to organize a Terraform or OpenTofu project: files, modules, environments, state splitting, versions and a monorepo layout that scales with the team.
- Terraform & OpenTofu Tutorials
Terraform Secrets Management: Keep Passwords Out of Code and State
How to handle secrets in Terraform and OpenTofu: sensitive variables, AWS Secrets Manager, SSM, generated passwords, ephemeral values and state encryption.
- Terraform & OpenTofu Tutorials
Terraform Workspaces vs Directories: How to Manage Environments
Compare Terraform and OpenTofu workspaces with separate directories and tfvars files to manage dev, pre and pro environments, and learn which one to use.
- Terraform & OpenTofu Tutorials
Terraform Security Scanning with tflint, Checkov and Trivy
Find misconfigurations in Terraform and OpenTofu code before deploying: tflint for errors, Checkov and Trivy for AWS security issues, with CI examples.
- Terraform Best Practices
Terraform and OpenTofu Best Practices for AWS and the Cloud
A practical checklist of Terraform and OpenTofu best practices: state, modules, versions, security, CI/CD, naming, testing and cost control.
- Terraform & OpenTofu Tutorials
How to Encrypt Terraform State with OpenTofu
Step-by-step guide to encrypting the Terraform state file with OpenTofu state encryption and AWS KMS, with a full configuration example.
- Terraform Best Practices
How to Share Infrastructure in Multiple Terraform Projects?
Sharing infrastructure across multiple Terraform projects using Data Sources helps maintain consistency, reduce redundancy, and promote collaboration.
- Terraform Best Practices
AWS and Terraform Naming Best Practices
Terraform and AWS resource naming should follow a company standard. Each company has different requirements and the standard should be adjusted.
- AWS Best Practices
AWS Tagging Best Practices
Effective infrastructure resource tagging can greatly improve management, IaC, monitoring and cost visibility in AWS.