Skipping InitAndApply and Destroy

446 Views Asked by At

Is there a way to skip the InitAndApply and Destroy phases of the test?

I want to just terraform output and build out my test assertions with testify/assert

1

There are 1 best solutions below

0
On

It does not fit very well for Terratest to skip the init and apply phases. Just because Terratest is an end-to-end test tool. According to the Terraform blog post Testing HashiCorp Terraform, Terratest as and end-to-end tool aims to answer the question:

Can someone use the infrastructure system successfully?” For example, application developers should still be able to deploy to HashiCorp Nomad after you upgrade the version.

For the type of test that you are looking for you might use a simple unit test like terraform validate that do not require active infrastructure resources or authentication to an infrastructure provider. Other tools for Terraform unit test can be found at the Some examples of Test-Driven Development for Infrastructure git repo.