pulumi-gcp: Missing configuration leads to poor errors
If I neglect to set my project, region, or zone configuration, I get an unhelpful error message:
error: Plan apply failed: project: required field is not set
Given that this will happen almost guaranteed for every new user of Pulumi on GCP, we should try to make this experience better. IIRC, we have some trick that we already use in the AWS package to hook errors like this and prettify them before displaying to the end user.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 1
- Comments: 16 (15 by maintainers)
Commits related to this issue
- Region config check (#1554) Should address issue raised in https://github.com/pulumi/pulumi-gcp/issues/129#issuecomment-1871319396 Adds region validation to the GCP provider. Error before (dur... — committed to pulumi/pulumi-gcp by VenelinMartinov 3 years ago
- Reintroduce region checks (#1666) Should fix https://github.com/pulumi/pulumi-gcp/issues/129 by reintroducing https://github.com/pulumi/pulumi-gcp/pull/1554 reverted in https://github.com/pulumi/pu... — committed to pulumi/pulumi-gcp by VenelinMartinov 3 years ago
I believe @ellismg and @jen20 looked into this and concluded it isn’t as easy as copying what we do in the AWS package, since you can set these on a per-resource basis.
This would be a very unfortunate conclusion. Here is a common experience with basic GCP programs, annotated with some of my own commentary/questions:
pulumi up:Plan apply failed: project: required field is not setgcloudproject? If I rungcloud info, it prints out the very project I want to use…pulumi config set gcp:project my-projectpulumi up:Plan apply failed: Cannot determine region: set in this resource, or set provider-level 'region' or 'zone'.pulumi config set gcp:region us-east1.@ellismg I know you had feedback on the GCP getting started flow. I’m actually wondering whether this was a problem for others on the team, or whether our tutorials make it so you don’t stumble here. (I’m always stumbling, but maybe I’m not paying close enough attention.) Thoughts?
Also /cc @swgillespie as I know improving errors is/was a passion of his, and I’m curious if he’s ever looked into this sort of “error rewriting” we might need to do on the fly in order to improve these messages.
I really liked the suggestion by https://github.com/pulumi/pulumi-gcp/issues/1641: Keep the get region call as a happy path for error messages, but don’t let it introduce a failure.
Reopening this because we had to revert because of a regression introduced by region validation. https://github.com/pulumi/pulumi-gcp/issues/1641 - this needs a little bit of rework to carefully account for Workload Identity Federation / OIDC style of authentication, not failing region validation when get region permission is unset as the user mentions in 1641.
I think most of the originally reported problems are no longer true. GCP now reports missing config as in @t0yv0’s comment above.
https://github.com/pulumi/pulumi-gcp/pull/1552 should address the duplicate warning about the lack of global project.
I am also working on adding validation for the region config in https://github.com/pulumi/pulumi-gcp/pull/1554
I actually just ran into this, and until I found this issue it wasn’t at all clear what the issue way.
One thing that was very helpful with the AWS provider is that when a required field is missing, like the
aws:regionconfiguration option, you get a much more helpful error:Can we at least make the error message clearer, or have the previous comments indicated why that isn’t possible?
we’ve been hit by it and it was confusing. I realise that upstream is not going to fix it,but it doesn’t mean Pulumi can’t do it’s part. One way would be to do merging with ambient defaults on Pulumi side and always pass project to TF explicitly or error before even calling TF is project is not set.