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
command/meta_backend: fix for cloud integration panic #30773
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🥳
@@ -320,6 +320,9 @@ func (m *Meta) BackendForPlan(settings plans.Backend) (backend.Enhanced, tfdiags | |||
|
|||
configureDiags := b.Configure(newVal) | |||
diags = diags.Append(configureDiags) | |||
if configureDiags.HasErrors() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would write this check under the configureDiags
assignment before appending. Besides that awesome work... I know a small change like this must have been painful to catch! 🔥
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a tricky thing about how we handle diagnostics in Terraform. Because diags
can contain warnings, we always append before checking for errors. This ensures that we always return diags
(which may have built up a series of warnings before encountering an error), rather than writing if subDiags.HasErrors() { return subDiags }
or similar.
All that to say: I think this change is actually okay, but wanted to point out that it is quite counter-intuitive.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me! I think it will also fix #30646.
Reminder for the merging maintainer: if this is a user-visible change, please update the changelog on the appropriate release branch. |
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. |
Description
Currently if an error occurs during client configuration,
b.Configure
it gets swallowed. This PR returns the error after it gets added to error diagnostics.Problem
Errors occurring during client configuration gets swallowed.
Fix
Fixes issue #30760
Tests
Unit tests already exists
Notes
Paired with @uturunku1