This topic provides an overview of the testing features in Terraform to help you validate your infrastructure.
Terraform provides the following types of testing capabilities:
terraform test
command documentation to learn more about this testing capability.The test
command performs the following actions:
For details about using the test
command, refer to the test
command reference documentation.
Terraform test files have their own configuration syntax. This test file syntax focuses on customizing Terraform executions for the current configuration and overriding variables and providers to test different behaviors.
Validations allow you to verify aspects of your configuration and infrastructure as it is applied and created. HCP Terraform also supports automated continuous validation.
The Terraform test
command also executes any validations within your configuration as part of the tests it executes. For more information on the available validation, refer to Checks and Custom Conditions.
You can write many validations as test assertions, but there are specific use cases for both.
Validations are executed during Terraform plan and apply operations, and the Terraform test
command also runs validations while executing tests. Therefore, use validations to validate aspects of your configuration that should always be true and could impact the valid execution of your infrastructure.
Module authors should note that validations are executed and exposed to module users, so if they fail, ensure the failure messages are understandable and actionable.
In contrast, Terraform only executes tests when you run terraform test
. Use tests to assert the correctness of any logical operations or specific behavior within your configuration. For example, you can test that Terraform creates conditional resources based on an input by setting the input controlling those resources to a certain value then verifying the resources Terraform creates.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4