Skip to content

plugin: return missing identity schema diagnostics in ReadResource#38683

Open
fallintoplace wants to merge 2 commits into
hashicorp:mainfrom
fallintoplace:fix/readresource-identity-diags
Open

plugin: return missing identity schema diagnostics in ReadResource#38683
fallintoplace wants to merge 2 commits into
hashicorp:mainfrom
fallintoplace:fix/readresource-identity-diags

Conversation

@fallintoplace
Copy link
Copy Markdown

What changed

This updates the gRPC provider ReadResource implementations for protocol 5 and protocol 6 to return immediately after appending the missing identity schema diagnostic.

I also added matching regression tests for both implementations.

Why

If a provider returns NewIdentity for a resource type whose schema does not include an identity schema, Terraform currently appends an error diagnostic and then continues into resSchema.Identity.ImpliedType(). That can panic instead of returning the diagnostic.

Testing

  • go test ./internal/plugin -run 'TestGRPCProvider_ReadResource(_missingIdentitySchema)?$'
  • go test ./internal/plugin6 -run 'TestGRPCProvider_ReadResource(_missingIdentitySchema)?$'
  • go test ./internal/plugin
  • go test ./internal/plugin6

@hashicorp-cla-app
Copy link
Copy Markdown

hashicorp-cla-app Bot commented Jun 4, 2026

CLA assistant check
All committers have signed the CLA.

@hashicorp-cla-app
Copy link
Copy Markdown

CLA assistant check

Thank you for your submission! We require that all contributors sign our Contributor License Agreement ("CLA") before we can accept the contribution. Read and sign the agreement

Learn more about why HashiCorp requires a CLA and what the CLA includes

Have you signed the CLA already but the status is still pending? Recheck it.

@fallintoplace fallintoplace marked this pull request as ready for review June 4, 2026 17:20
@fallintoplace fallintoplace requested a review from a team as a code owner June 4, 2026 17:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant