When attempting to create a Cloud SQL User using P...
# google-cloud
t
When attempting to create a Cloud SQL User using Pulumi Classic (Python), I receive this error:
Copy code
error: expected non-nil error with nil state during Create of urn:pulumi:dev::****::gcp:sql/user:User::db user addl-user1 in **
code sample:
Copy code
gcp_classic_db_user.User(resource_name=f'db user {user_args.username} in {created_instance_name}',
                                            args=user_args.database_user_args,
                                            opts=ResourceOptions(depends_on=self.instance))
Any ideas on how to fix this?
g
That's the kind of error I'd expect if there's a missing config in either the user object or the database object. Can you share a bit more of the code, specifically what's defining the user_args?
t
So, what's interesting is that it actually creates the resources, but for each user I add to the database, that message comes back. And it isn't actually stored in the pulumi state.
the arguments in the
user_args
are here:
Copy code
class AdditionalDatabaseUserArgs:
    def __init__(self,
                 project: str,
                 username: str,
                 instance: str,
                 password: str = None,
                 host: str = 'localhost'): # password is required for postgres
        if password is None:
            password = pulumi_random.RandomPassword(f"password for {username}", length=15, special=True).result
        self.username = username
        self.instance = instance
        self.password = password
        self.host = host
        self.database_user_args = gcp_classic_db_user.UserArgs(instance=instance, name=username, password=password, host=host, project=project)
so it creates the user in the GCP Classic Provider
g
huh, interesting. Give me a bit to dig in and see what I can figure out
t
Thank you!
g
We're still digging into it; had to pull a couple other folks in.
t
all good. I appreciate the effort!
Hi Laura, just checking in here to see if you've got an update. Thanks!
g
Hi! So it looks like our system is swallowing the underlying error coming from the bridge (we've got a PR in the works to patch that so the error surfaces properly). At the moment, I don't know exactly what's wrong with your code, unfortunately 😞
t
No worries! Thank you for taking a look at it. do you know if that PR is public and if so, can you link it to me?
g
It should be! I don't see the specific one that was being discussed up just yet, but here's the repo to watch: https://github.com/pulumi/pulumi-terraform-bridge/ It does look like they're debating whether this PR answers the question, though: https://github.com/pulumi/pulumi-terraform-bridge/pull/401
t
awesome, thank you!!
🙇‍♀️ 1