InfraCoding with Terraform: Writing Tests for Infrastructure-as-Code
summary
Claim: infrastructure-as-code without tests equals self-sabotage. Concrete tools and outcomes: quick unit tests run locally with terraform validate/TFLint catch syntax and edge-variable errors; longer state tests create and destroy real infra using Terratest (example: a t1 micro full apply and destroy in ~1 minute) and provider acceptance suites (Azure full suite ≈10 hours, AKS ≈15–20 minutes); integration via kitchen-terraform + InSpec verifies provisioning over SSH; policy-as-code with Sentinel and Terraform Cloud cost estimates blocks a proposed c5 metal that raises monthly cost to ~$4k against a $1k policy.
AI-written summary · about
chapters (11)
- 0:00Start
- 7:24The only "real" Terraform unit test..
- 9:44clarity example
- 10:55terraform-compliance example
- 11:17terraform validate
- 18:27Terraform Testing SDK example
- 18:57Full Suite example for Azure
- 20:46terratest example
- 25:03kitchen-terraform example
- 27:12HashiCorp Sentinel
- 27:44Sentinel example for Terraform
related talks
52mTest Driven Delivery of Infrastructure-As-Code
17mTDD for Infrastructure Code
47mInfrastructure Testing explained
36mBuild infrastructure as a code (IaC) using test-later...
35mTesting in Infrastructure as Code
46mThink of your infrastructure as code
10mInfrastructure as a Code Best Practices with Terraform
52mInfrastructure as Code with Terraform
