Last month, New Context released its first open-source project, kitchen-terraform. kitchen-terraform was created to bring the benefits of test-driven development to Terraform projects. As use of Terraform continues to gain popularity in production environments, it is critical that this logic is thoroughly tested. kitchen-terraform allows Terraform development to be driven by a suite of tests to verify new features and protect against regressions.
Effective infrastructure testing is a core competency of engineers at New Context. Since clients have begun to migrate their infrastructure to Terraform, we have been researching and discussing a testing solution. As Terraform is still in unstable development, testing upgrades is equally as valuable as testing new infrastructure features.
Due to the complexity of describing a large computing environment with code, we wanted the testing solution to be straightforward. As many New Context engineers have extensive experience with Chef, we were already familiar with Test Kitchen. Test Kitchen is an integration tool that allows for testing a range of platforms, management tools and test frameworks. Writing a Terraform testing tool based in Test Kitchen afforded us a readily extensible orchestration engine and a well-known workflow to ease adoption.
Using kitchen-terraform enables a test matrix that can vary in platforms, input variables and even fixture modules. kitchen-terraform provides a consistent approach for testing Terraform projects locally and in continuous integration pipelines.
Currently, kitchen-terraform is limited to evaluating server resources with Inspec profiles, but an upcoming feature release will introduce the ability to execute profiles against other elements of hosting platforms, enabling the possibility of complete test coverage for a Terraform project. Supporting other test frameworks is also high the agenda, as well as introducing support for Terraform’s latest release.