Terraform

How do you test a Terraform module?

Difficulty: unrated

Source: bregman-arie/devops-exercises by Arie Bregman

Answer

There are multiple answers, but the most common answer would likely to be using the tool terratest, and to test that a module can be initialized, can create resources, and can destroy those resources cleanly. You can also rely on terraform validate, terraform plan with sample configurations, and linting tools such as tflint.