https://pulumi.com logo
#python
Title
# python
s

sticky-bear-14421

06/04/2021, 1:50 PM
Hello everyone, After solving my Routing and other funny issues I have created an AWS Redshift instance and now I want to create users and grants in this cluster.
Copy code
redshift_cluster = aws.redshift.cluster(..)

pg_provider = postgresql.Provider('redshift_cluster',
    database=redshift_cluster.database_name,
    host=redshift_cluster.dns_name,
    port=redshift_cluster.port,
    username=redshift_cluster.master_username,
    password=redshift_cluster.master_password)

my_user = postgresql.Role('my_user',
    name="my_user",
    password="123456",
    login=True,
    create_database=False,
    create_role=False,
    superuser=False,
    opts=pulumi.ResourceOptions(provider=pg_provider)
But, when I try to apply this code it will fail with an SQL error:
Copy code
error: error creating role my_user: pq: syntax error at or near "ROLE"
Any ideas what is wrong with my Role() definition?
e

enough-garden-22763

06/04/2021, 1:55 PM
Redshift does not speak the Postgres dialect precisely, there’re differences especially around things like roles. I.e. they both support CREATE USER but only Postgres supports CREATE ROLE
s

sticky-bear-14421

06/04/2021, 1:57 PM
And as the Pulumi PostgreSQL provider only has a Role Resource it won't be able to create a Role within a Redshift derivate of PostgreSQL
I see
Do you have plans for adding the User aswell?
Am not too familiar with PostgreSQL, but User was the old concept, Roles are the new way to go?
What about adding a Script resource to the provider for raw SQL scripts to execute, this could help in cases of feature incompatibilities like mine
e

enough-garden-22763

06/04/2021, 2:10 PM
I’m not too familiar with this part of the codebase yet, but it sounds like if things like this are missing https://github.com/pulumi/pulumi-postgresql/issues adding requests to issue tracker can be very helpful
👍 1
s

sticky-bear-14421

06/04/2021, 2:11 PM
Awesome, will add a feature request. Thanks for your help
👍 1