Loading...
Loading...
### Terraform Version ```shell v1.11.3 ``` ### Terraform Configuration Files ```terraform check "failures" { assert { condition = can(regex("ERROR", data.local_file.pytest_log.content)) == false && !contains(jsondecode(data.local_file.pytest_output.content).tests[*].outcome, "failed") error_message = data.local_file.pytest_log.content } } ### run "pytest_failing" { command = apply variables { env_vars = { RESULT = "FAILURE" } } module { source = "./examples/pytest" } expect_failures = [ check.failures ] } ``` ### Debug Output ``` Error: Missing expected failure │ │ on tests/test_examples.tftest.hcl line 66, in run "pytest_failing": │ 66: check.failures │ │ The checkable object, check.failures, was expected to report an error but did not. ╵ ╷ │ Error: Check block assertion failed │ │ on modules/pytest/main.tf line 30, in check "failures": │ 30: condition = can(regex("ERROR", data.local_file.pytest_log.content)) == false && !contains(jsondecode(data.local_file.pytest_output.content).tests[*].outcome, "failed") │ ├──────────────── .... ``` ### Expected Behavior When precondition, postconditon or check returns an error I should be able to expect this as a failure in test cases ### Actual Behavior Test fails, expected_failure not found when using checks, pre or postconditons with data/resource objects ### Steps to Reproduce terraform test with expect_failures referring to any data/resource/check conditions ### Additional Context _No response_ ### References _No response_ ### Generative AI / LLM assisted development? _No response_
Click on a version to see all relevant bugs
Terraform Integration
Learn more about where this data comes from
Bug Scrub Advisor
Streamline upgrades with automated vendor bug scrubs
BugZero Enterprise
Wish you caught this bug sooner? Get proactive today.