terratest
terratest copied to clipboard
using terratest in existing infrastructure in staging or production
Can terratest be used in existing infrastructure in staging or production ? If yes, should we use InitAndApply and Destroy function ? Because, InitAndApply, Initialize and Apply Terraform Configurations what already exists Destroy, delete the resources.
Should we only use when there are some changes?
You should not use it with either.
Well-designed Terraform code is modular, fully-automated, and should empower the creation of ephemeral environments that can be easily created/destroyed.
Terratest can help you validate that your Terraform code does what you think it does — just like automated testing in software development — by running independently of any of your existing environments. Maybe run them from a PR/branch instead of your default branch which should represent what you have deployed to live environments.