I have multiple (2 as of now) tftest.hcl
files in our project repository (functionally, one for each list of services broken down in .tf
files). Running terraform test
in the source directory gets *.tftest.hcl
files in the tests/
directory and runs them one after another. But, terraform applies and tears down the resources after running through each file in the tests
directory.
Is there a way to control the test framework to create resources at the start and tear down after going through all the test files at the end?
I am using Terraform v1.7.3.
Below is what I see in my shell -
terraform test -var aws-profile=dev
tests\test_resource_support.tftest.hcl... in progress
run "test_bucket_names"... pass
run "test_bucket_notification"... pass
run "test_backup_vault"... pass
run "test_backup_vault_lock"... pass
run "test_backup_plan"... pass
run "test_backup_selection"... pass
run "test_cloudwatch_event_rule"... pass
run "test_cloudwatch_event_rule_target"... pass
run "test_sns_topic"... pass
run "test_sns_topic_subscription"... pass
run "test_sns_topic_policy"... pass
tests\test_resource_support.tftest.hcl... **tearing down**
tests\test_resource_support.tftest.hcl... pass
**tests\test_resource_symmetric-pipeline.tftest.hcl... in progress**
run "test_bucket_objects"... fail
....
....
....