Testing Your HCL Modules for Terraform
summary
Describes an automated way to unit test HCL by moving logic into locals, loading YAML with yamldecode, and feeding processed maps through Terraform’s external data source into a small Python test fixture that prints pass/fail; an example run shows four unit tests passed. Tests live in a test dir that symlinks real locals files, run terraform init/apply, and are automated with GitHub Actions. Integration jobs create transient GCP projects, push an image, deploy to GKE, Cloud Run and App Engine, then destroy.
AI-written summary · about
chapters (11)
- 0:00Introduction and backstory
- 2:16The need for testing
- 3:40Testing concepts
- 5:09Benefits of testing
- 7:01Testing approaches
- 8:58Implementing unit tests
- 10:45YAML configuration
- 12:32Test execution
- 16:00Automating unit tests
- 19:47Integration testing
- 23:24Q&A and conclusion
related talks
17mTDD for Infrastructure Code
36mBuild infrastructure as a code (IaC) using test-later...
52mTest Driven Delivery of Infrastructure-As-Code
47mInfrastructure Testing explained
33mBuilding applications with infrastructure as code
37mInfraCoding with Terraform: Writing Tests for Infrastructure-as-Code
35mTesting in Infrastructure as Code
25mWhat's New in Terraform 0.12?
