Closed pdemagny closed 2 weeks ago
Hey @pdemagny. Sorry you've had trouble here. Looking at your code it looks like you are typing the ProjectId
input to the Provider as pulumi.StringOutput
. I don't believe that providers support output
-type inputs, which is what the error message is trying to tell you.
Can you try changing that to:
type (
ResourceArgs struct {
Name string
ProjectId string
Region string
}
That should work much better as that promises pulumi that the project id configuration will always be available - it can not be unknown.
When I modify my code with your suggestion, it demonstrates the expected behavior:
error: rpc error: code = Unknown desc = expected a non-empty string: project was set to ``
Thanks for the fix. But it's still possible to pass a StringOutput that ends up potentialy unknown and risk breaking stuff, isn't there a way to prevent this ?
Hey @pdemagny. Do you think the warning is insufficient here? Would you prefer it if we provided a flag for this to become a hard error? Unfortunately we can not do this by default as some user programs do depend on this behaviour and we'd like to avoid breaking them.
Hi @VenelinMartinov. I think it would definitely be best if was an error instead of a warning, but not at the cost of a breaking change, and anyway that's not my place to tell 😅 In this case I think the warning could be enough, since it's gonna be a rare bug, but the warning could maybe be clearer somehow.
Glad you managed to fix the issue on your end. Let me know if you run into any more troubles here!
Describe what happened
After an upgrade of this provider and without any changes in my codebase (can't remember exactly but it was around may I think), I started having very weird previews:
I would get a lot of warnings:
And lots of values would end up unknown again:
And lots of occurences in the diff of:
And other randomly removed properties on resources ...
Sample program
I have this package that is overly complex for what it does, but it looks like this to maintain consistency with all our other packages in our codebase that all implements the Golang Functional Options Pattern.
As i said I can't find out what version it was, but a version of the Pulumi GCP Provider required me to add the Project option to the NewProvider() method. But it doesn't seem to be a hard requirement, so when I create the provider like this:
It causes warnings and ultimately errors and panic (same result with both pulumi cli & automation api):
And it goes like this for all resources of this provider.
If I try to apply anyway:
When I remove only the Region instead of the Project, i get the expected:
Finally When I create the provider like this:
Everything works as expected !
I suspect that somehow with my code the Project ends up nil and it makes the provider loose his mind instead of just saying that it can't be empty (as it does when I don't provide the Region).
Log output
No response
Affected Resource(s)
Output of
pulumi about
❯ pulumi about CLI
Version 3.137.0 Go Version go1.23.2 Go Compiler gc
Host
OS ubuntu Version 22.04 Arch x86_64
Backend
Name pulumi.com URL https://app.pulumi.com/pdemagny-blobr User pdemagny-blobr Organizations pdemagny-blobr, blobr-io, blobr-ai Token type personal
Pulumi locates its logs in /tmp by default
Additional context
This is related to support ticket n°5654.
Contributing
Vote on this issue by adding a 👍 reaction. To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).