I have tried install checkov and Terraform-python-testing-helper on GCP console but all failed.
Does anyone have other solutions or better experience?
Thank you very much.
I have tried install checkov and Terraform-python-testing-helper on GCP console but all failed.
Does anyone have other solutions or better experience?
Thank you very much.
These days, Terraform has a builtin test framework for both unit and integration testing. I would try that first, and see if it solves your use case.
You can do, essentially, unit tests, by using a mock provider and / or running tests in plan only mode, and you can also do integration tests.
There are some other options there, including:
GitHub - gruntwork-io/terratest: Terratest is a Go library that makes it easier to write automated tests for your infrastructure code. - Gruntwork’s terratest framework
GitHub - newcontext-oss/kitchen-terraform: Test Kitchen plugins for testing Terraform configurations was for a long time one of the standards for integration testing, but it’s now deprecated
GitHub - GoogleCloudPlatform/terraform-python-testing-helper: Simple Python test helper for Terraform. (tftest) - expectation based inspection of the plan in Python
I’ve seen checkov
used more as a security scanning framework than for generic unit testing (can also see trivy
and the (now deprecated) tfsec
in this space.