It seems that the way of importing modules and mocks has changed with 0.19. However, even updating the test files to e.g. the following does not solve the error:
For internal reference: we also have a support ticket open addressing this issue: 93385.
For us it’s most important that no Terraform Enterprise upgrade is using 0.19.x as Sentinel runtime before that one is fixed, because that would block our patch management process.
FYI, I’ve just released 0.19.2-rc1 which has a potential bug fix for your issue. If you are able to test it out and let me know the outcome that would be great.
With 0.19.1, we’re getting 70 passing and 651 failing tests.
With 0.19.2-rc1 it’s getting better with 580 passing and 141 failing.
It’s creating the same error message for the failing tests (but now basically always outputting it twice):
Error configuring policy 2 errors occurred:
* unexpected node type *localast.ImportExpr when walking
* unexpected node type *localast.ImportExpr when walking
FWIW, I was also getting this same issue with 0.19.1 (0.19.0 partially fixed it in some new tests but not all). It would only pass the first (alphanumeric ordered) test which for a lot of my tests is 50% but for some of the cloud-agnostic ones there were multiple tests per policy.
I just want to report that when using 0.19.2-rc1 all of my tests are now passing.
Thank you everyone for providing us with details surrounding the ongoing issues, in particular any issues that were still present in 0.19.2-rc1. Our team is getting back up to speed after a well deserved holiday break and will be working on resolving this issue as soon as possible.