kitchen-terraform: Cooking Up a New World

Introducing kitchen-terraform

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.

Motivation

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.

Implementation

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.

Benefits

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.

Upcoming Features

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.

By | 2016-10-24T19:43:23+00:00 August 21st, 2016|Blog|

About the Author:

Aaron Lane is a Senior DevOps Engineer at New Context. He started his adventure in software configuration and delivery at IBM and OTPP. Aaron has a penchant for testing the untestable.