terraform test

The command, added in Terraform 1.6, that runs the scenarios in .tftest.hcl files against a module and reports which assertions passed.

In more detail

Each test file holds run blocks that plan or apply the module with chosen variables and check results with assert blocks. Tests that apply create real infrastructure and destroy it afterwards unless providers are mocked. Tests ask whether the module behaves as designed; policy asks whether a change is allowed.

Example

terraform test

Related terms

Taught in

References

Certification courses