-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Improve the error message arising from missing required configs for resource providers #1097
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.
I only reviewed the PR description and changelog, but it looks good!
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.
LGTM aside from a few nits
// variables, tfbridge will respond with a list of missing variables and their descriptions. | ||
// If that is what occurred, we'll use that information here to construct a nice error message. | ||
func createConfigureError(err *rpcerror.Error) error { | ||
var aggregateErr error |
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.
Nit: how about renaming the parameter rpcerr
and doing something like the following:
var err error = rpcerr
for _, detail := range rpcerr.Details() {
...
err = multierror.Append(err, singleError)
}
return err
sdk/proto/provider.proto
Outdated
// ConfigureErrorMissingKeys is sent as a Detail on an error returned from `ResourceProvider.Configure`. | ||
message ConfigureErrorMissingKeys { | ||
message MissingKey { | ||
string name = 1; // the Pulumi name (not the TF name!) of the missing config key. |
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.
s/TF/provider
sdk/proto/provider.proto
Outdated
message ConfigureErrorMissingKeys { | ||
message MissingKey { | ||
string name = 1; // the Pulumi name (not the TF name!) of the missing config key. | ||
string description = 2; // a description of the missing config key, from the TF schema. |
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.
Do not mention TF here: not all providers will be TF-based
Likewise, do not mention TF/tfbridge/etc. in the commit message. Resource providers != terraform in the general case. |
resource providers If the resource provider that we are speaking to is new enough, it will send across a list of keys and their descriptions alongside an error indicating that the provider we are configuring is missing required config. This commit packages up the list of missing keys into an error that can be presented nicely to the user.
20b355e
to
53c7bac
Compare
53c7bac
to
3d693bd
Compare
thanks for the reviews! |
If the tfbridge that we are speaking to is new enough, it will send
across a list of keys and their descriptions alongside an error
indicating that the provider we are configuring is missing required
config. This commit packages up the list of missing keys into an error
that can be presented nicely to the user.
Take 2! This is the first of two PRs that implement this new error message functionality; a companion PR will be opened in
pulumi-terraform
that implements the server portion of these changes. Because of the way our Go dependency graph is shaped, this PR will need to be merged before thepulumi-terraform
one.The idea here is that, before
tfbridge
asks Terraform to validate a set of configs, it will first check the list of config keys we give it against the list of configs known to us (through the TF Schema) to be required. Iftfbridge
sees any keys that it does not recognize, it'll send an error response to theConfigure
RPC call and attach aConfigureErrorMissingKeys
detail to the error, which we as the plugin host can interpret and provide a specific error message for each missing key.With all pieces in place (including updates to
pulumi-aws
andpulumi-terraform
, which will come from follow-up PRs), this is the new output:For the changelog:
This change improves the error message that appears whenever a required configuration key is not provided, such as
aws:region
. The error message will now print out the names of all missing configuration keys as well as a description of the key's function.