github.com/darmach/terratest@v0.34.8-0.20210517103231-80931f95e3ff/docs/_docs/02_testing-best-practices/idempotent.md (about) 1 --- 2 layout: collection-browser-doc 3 title: Idempotent 4 category: testing-best-practices 5 excerpt: >- 6 Test that your Terraform configuration results in consistent deployments. 7 tags: ["testing-best-practices", "idempotent", "terraform"] 8 order: 212 9 nav_title: Documentation 10 nav_title_link: /docs/ 11 --- 12 13 A Terraform configuration is idempotent when a second apply results in 0 changes. An idempotent configuration ensures that: 14 15 1. What you define in Terraform is exactly what is being deployed. 16 1. Detection of bugs in Terraform resources and providers that might affect your configuration. 17 18 You can use Terratest's `terraform.ApplyAndIdempotent()` function to both apply your Terraform configuration and test its 19 idempotency. 20 21 ```go 22 terraform.ApplyAndIdempotent(t, terraformOptions) 23 ``` 24 25 If a second apply of your Terraform configuration results in changes then your test will fail.