Skip to content

add unknown paths to diags for debugging#31111

Merged
jbardin merged 1 commit intomainfrom
jbardin/unknown-error-paths
May 24, 2022
Merged

add unknown paths to diags for debugging#31111
jbardin merged 1 commit intomainfrom
jbardin/unknown-error-paths

Conversation

@jbardin
Copy link
Copy Markdown
Member

@jbardin jbardin commented May 23, 2022

When a user reports a "Configuration contains unknown value" error,
there is no information on what might have been unknown during apply.
Add unknown attribute paths to the diagnostic message to provide some
more information when a reproduction may not be possible. Sine this is
one of those "should never happen" types of errors which will be
reported to the developers directly, we can leave the format as the raw
internal representation for simplicity.

When a user reports a "Configuration contains unknown value" error,
there is no information on what might have been unknown during apply.
Add unknown attribute paths to the diagnostic message to provide some
more information when a reproduction may not be possible. Sine this is
one of those "should never happen" types of errors which will be
reported to the developers directly, we can leave the format as the raw
internal representation for simplicity.
@jbardin jbardin added the 1.2-backport If you add this label to a PR before merging, backport-assistant will open a new PR once merged label May 23, 2022
@jbardin jbardin requested a review from a team May 23, 2022 17:34
@jbardin jbardin self-assigned this May 23, 2022
diags = diags.Append(tfdiags.Sourceless(
tfdiags.Error,
"Configuration contains unknown value",
fmt.Sprintf("configuration for %s still contains unknown values during apply (this is a bug in Terraform; please report it!)\n"+
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this always a problem in Core, or could it be a provider bug?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is a core bug in that we should have caught an unknown value before we even get here. Once we've gotten this far it's kind of too late, but hopefully at least showing which part of the config was unknown can help track down the source of the unknown value.

@jbardin jbardin merged commit 2ad3ac7 into main May 24, 2022
@jbardin jbardin deleted the jbardin/unknown-error-paths branch May 24, 2022 14:37
@github-actions
Copy link
Copy Markdown
Contributor

Reminder for the merging maintainer: if this is a user-visible change, please update the changelog on the appropriate release branch.

@github-actions
Copy link
Copy Markdown
Contributor

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 24, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

1.2-backport If you add this label to a PR before merging, backport-assistant will open a new PR once merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants