Often we find that Terraform (HCL) modules are being written in a way to be able to handle multiple conditions on given data or differing environments. This demand drives modules requiring logic to be coded into them; and as a result, just like any other code, this logic should be tested.
Arguably, simply running Terraform against some mock environment is already a functional/acceptance test which you can script to prove that the thing you expected to deploy actually got deployed, There are also frameworks out there for validating plans or deployments against some constraints. However, there is little in the form of performing unit tests.
This talk covers an automated process we have for authors of Terraform modules to be able to systematically and incrementally unit test small changes in HCL against expected test results and functionally test the module as a whole in a controlled environment before being released.
The talk will demonstrate:
Speaker: Gareth Brown
Some speakers have posted slides here: https://discuss.hashicorp.com/t/hashitalks-2021-speaker-slides/20732
#terraform