Skip to content

Commit 9482482

Browse files
tongshen-stephanieStephanie Shen
andauthored
Fix Redshift multi user rotation Lambda for users with permissions on DBs created from datashare (#141)
Co-authored-by: Stephanie Shen <tongshen@amazon.com>
1 parent f04812b commit 9482482

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

SecretsManagerRedshiftRotationMultiUser/lambda_function.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,8 @@ def set_secret(service_client, arn, token):
217217
(current_dict['username'], perm))
218218
databases = [row.datname for row in cur.fetchall()]
219219
if databases:
220-
cur.execute("GRANT %s ON DATABASE %s TO %s" % (perm, ','.join(databases), pending_username))
220+
for database in databases:
221+
cur.execute("GRANT %s ON DATABASE %s TO %s" % (perm, database, pending_username))
221222

222223
# Grant table permissions
223224
table_perm_types = ['SELECT', 'INSERT', 'UPDATE', 'DELETE', 'REFERENCES']

0 commit comments

Comments
 (0)