Skip to content

Unit Test IaC with Terraform Tests

Testing Terraform

PAGE UNDER CONSTRUCTION

A challenge of being a DevOps engineer is that some of the typical dev parts don't always fit nicely. Unit testing is one example, where IaC is often hard to test in isolation and without some sort of actual deployment in a "test" or "sandbox" environment to validate against.

The lines between unit and integration testing become blurred for many DevOps or Platform engineers. Thankfully, HashiCorp has seen this gap and has introduced Terraform Tests to help bridge this gap!

In this post I will go over some basic unit testing that can be done for validating your IaC using terraform test to improve your code quality and provide additional peace of mind when making changes to your IaC!