pulumi / pulumi-terraform-bridge

A library allowing providers built with the Terraform Plugin SDK to be bridged into Pulumi.
Apache License 2.0
183 stars 41 forks source link

Improve ValidationError Error() #2056

Closed t0yv0 closed 3 weeks ago

t0yv0 commented 3 weeks ago

Improve ValidationError Error() to expose AttributePath. It appears that ValidationError is the bridge representation of any and all underlying TF Diagnostics. Allowing all the information to be printed can help save time when trying to understand unrecoverable error messages emitted from TF internals.

t0yv0 commented 3 weeks ago

Let's see if this trips up any tests.

codecov[bot] commented 3 weeks ago

Codecov Report

Attention: Patch coverage is 94.28571% with 2 lines in your changes missing coverage. Please review.

Project coverage is 61.48%. Comparing base (c6611a4) to head (1ac30c3). Report is 4 commits behind head on master.

Files Patch % Lines
pkg/tfbridge/adapt_check_failures.go 85.71% 2 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #2056 +/- ## ========================================== + Coverage 61.44% 61.48% +0.04% ========================================== Files 334 334 Lines 44951 44985 +34 ========================================== + Hits 27621 27660 +39 + Misses 15806 15800 -6 - Partials 1524 1525 +1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

t0yv0 commented 3 weeks ago

I hit the issue with this when state upgraders encountered state that did not match schema, and they emitted an error message, but the way it presented in Pulumi dropped the path to the property that had the problem so I was looking at "invalid '[' expected" message which did not help at all.

This is essentially a follow-up on https://github.com/pulumi/pulumi-terraform-bridge/pull/2053

It's all driven by trying to get AWS to pass tests under PlanResourceChange.