You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd like to be able to pass an argument for plan or apply to tests. In some case I may want to just run a plan based test to get faster feedback. For example maybe I want something like pre-commit-terraform to run plan tests on each commit but the feedback loop for apply is too long.
I'd like to keep both assertions in the same test and pass either a plan or apply at the CLI and have test run the respective assertion.
Or maybe we can nest the command arg:
run"tests" {
# Can validate in planassert {
command = apply
condition = google_storage_bucket.test.name=="foo-tf847gz7d"
error_message ="Invalid bucket name"
}
# Can't validate in planassert {
command = plan
condition = google_storage_bucket.test.self_link=="https://www.googleapis.com/storage/v1/b/foo-tf847gz7d"
error_message ="Invalid self link"
}
}
Attempted Solutions
I was thinking to write two tests and call the test with the -filter argument but then I'd be doing a lot of copy/paste of assertions assuming I would want to run all the "plan" assertions on the apply run seeing it's a more thorough test.
Proposal
No response
References
No response
The text was updated successfully, but these errors were encountered:
Thanks for this feature request! If you are viewing this issue and would like to indicate your interest, please use the 👍 reaction on the issue description to upvote this issue. We also welcome additional use case descriptions. Thanks again!
Terraform Version
Use Cases
I'd like to be able to pass an argument for plan or apply to tests. In some case I may want to just run a plan based test to get faster feedback. For example maybe I want something like pre-commit-terraform to run plan tests on each commit but the feedback loop for apply is too long.
Let's assume this simple use-case:
main.tf:
tests/my.tftest.hcl
I'd like to keep both assertions in the same test and pass either a plan or apply at the CLI and have test run the respective assertion.
Or maybe we can nest the command arg:
Attempted Solutions
I was thinking to write two tests and call the test with the -filter argument but then I'd be doing a lot of copy/paste of assertions assuming I would want to run all the "plan" assertions on the apply run seeing it's a more thorough test.
Proposal
No response
References
No response
The text was updated successfully, but these errors were encountered: