electric-sql / electric-sql/pglite
CREATE ROLE electric permissions
- Dominant language
- TypeScript
- Stars
- 16k
- Forks
- 442
- Avg merge
- 20h 19m
- Merged PRs (30d)
- 7
Description
Our primary user has auto-rotation for its password [docs.aws.amazon.com/secretsmanager/latest/userguide/rotate-secrets_turn-on-for-db.html](https://docs.aws.amazon.com/secretsmanager/latest/userguide/rotate-secrets_turn-on-for-db.html). We want to create another role with a static password with the minimal permissions needed, however I don't see a guide on how to do this or what permissions would be needed.
Would you be able to point me in the right direction? unsure if this goes here or in electric.
```
DO $$
BEGIN
IF NOT EXISTS (
SELECT
1
FROM
pg_roles
WHERE
rolname = 'zeus') THEN
CREATE ROLE zeus LOGIN CONNECTION LIMIT 100;
GRANT rds_replication TO zeus;
ELSE
ALTER ROLE zeus LOGIN CONNECTION LIMIT 100;
GRANT rds_replication TO zeus;
END IF;
END
$$;
-- DB connect (idempotent)
GRANT CONNECT ON DATABASE postgres TO zeus;
-- Run the following in the "postgres" database if you actually want table reads:
GRANT USAGE ON SCHEMA public TO zeus;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO zeus;
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT
SELECT
ON TABLES TO zeus;
```
this is the general direction we went for the user. let me know if there are issues please!
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.