Testing Terraform module code with Terratest
When developing a Terraform module that will be used in multiple Terraform configurations and shared with other teams, there is one step that is often neglected and that is the testing of the module.
Among the Terraform framework and testing tools is the Terratest framework, and the documentation is available here – https://gruntwork.io/ – which is popular and allows you to write tests in the Go language.
In this recipe, we will study how to use Terratest to write and run integration tests against Terraform configuration and modules.
Let’s get started!
Getting ready
The Terratest test framework is written in Go. That’s why, as a prerequisite, we need to install Go by going to https://golang.org/.
The minimum Go version required for Terratest is specified here: https://terratest.gruntwork.io/docs/getting-started/quick-start/#requirements.
The Go installation depends on your...