Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: better type checking error messages #1997

Merged
merged 4 commits into from
May 22, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions pkg/tfbridge/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -803,9 +803,6 @@ func (p *Provider) Check(ctx context.Context, req *pulumirpc.CheckRequest) (*pul
iv := NewInputValidator(urn, *schema)
typeFailures := iv.ValidateInputs(t, news)
if typeFailures != nil {
logger.Warn("Type checking failed. If any of these are incorrect, please let us know by creating an" +
"issue at https://github.com/pulumi/pulumi-terraform-bridge/issues.",
)
for _, e := range *typeFailures {
if validateShouldError {
pp := NewCheckFailurePath(schemaMap, schemaInfos, e.ResourcePath)
Expand All @@ -815,9 +812,16 @@ func (p *Provider) Check(ctx context.Context, req *pulumirpc.CheckRequest) (*pul
Property: string(cf.Property),
})
} else {
logger.Warn(fmt.Sprintf("%v verification warning: %s: Examine values at %s", urn, e.Reason, e.ResourcePath))
logger.Warn(
fmt.Sprintf("Type checking failed:\n Unexpected type at field %s: \n %s", e.ResourcePath, e.Reason),
corymhall marked this conversation as resolved.
Show resolved Hide resolved
)
}
}
logger.Warn("Type checking is still experimental. If you believe that a warning is incorrect,\n" +
"please let us know by creating an " +
"issue at https://github.com/pulumi/pulumi-terraform-bridge/issues.\n" +
"This will become a hard error in the future.",
)
}
}
}
Expand Down