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

[0.14 backport] Fix empty diags not getting associated with source. #28029

Merged
merged 2 commits into from Mar 9, 2021

Conversation

pselle
Copy link
Contributor

@pselle pselle commented Mar 9, 2021

Backport of #27710

Fixes #27283

Right now, there's a bug that if a diagnostic comes back from the
provider with an AttributePath set, but no steps in the AttributePath,
Terraform _thinks_ it's an attribute-specific diagnostic and not a
whole-resource diagnostic, but then doesn't associate it with any
specific attribute, meaning the diagnostic doesn't get associated with
the config at all.

This PR changes things to check if there are any steps in the
AttributePath before deciding this isn't a whole-resource diagnostic,
and if there aren't, treats it as a whole-resource diagnostic, instead.

See hashicorp/terraform-plugin-sdk#561 for more details on how this
surfaces in the wild.
Add a test for a diagnostic with no steps to make sure it still gets
associated with the resource in the config. Follow up to #27710 using
@alisdair's suggested testing.
@codecov
Copy link

codecov bot commented Mar 9, 2021

Codecov Report

Merging #28029 (f5a1aed) into v0.14 (618a3ed) will decrease coverage by 0.00%.
The diff coverage is 100.00%.

Impacted Files Coverage Δ
plugin/convert/diagnostics.go 50.64% <100.00%> (ø)
dag/marshal.go 53.42% <0.00%> (-1.37%) ⬇️
states/statefile/version4.go 57.96% <0.00%> (-0.24%) ⬇️

@ghost
Copy link

ghost commented Apr 9, 2021

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@hashicorp hashicorp locked as resolved and limited conversation to collaborators Apr 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants