【发布时间】:2022-12-17 10:44:50
【问题描述】:
这里的第一个答案是有关如何为您的 Google Platform Cloud SQL 实例创建 Cloud SQL IAM 用户的指南。
Here is a guide on how to connect after you've created the user.
【问题讨论】:
标签: postgresql google-cloud-platform google-cloud-sql
这里的第一个答案是有关如何为您的 Google Platform Cloud SQL 实例创建 Cloud SQL IAM 用户的指南。
Here is a guide on how to connect after you've created the user.
【问题讨论】:
标签: postgresql google-cloud-platform google-cloud-sql
postgres用户连接到数据库。使用此用户,我们可以将权限分配为IAM 用户创建时对数据库对象的权限为零.
grant connect on database database_name to "username@email.com";
-- Grant usage on current objects in a schema
grant all on SCHEMA schema_name to "username@email.com";
grant all on all TABLES in SCHEMA schema_name to "username@email.com";
grant all on all FUNCTIONS IN SCHEMA schema_name to "username@email.com";
grant all on all PROCEDURES IN SCHEMA schema_name to "username@email.com";
grant all on all ROUTINES IN SCHEMA schema_name to "username@email.com";
grant all on all SEQUENCES IN SCHEMA schema_name to "username@email.com";
-- Grant usage of any newly created objects in the future
ALTER DEFAULT PRIVILEGES IN SCHEMA schema_name GRANT all ON FUNCTIONS TO "username@email.com";
ALTER DEFAULT PRIVILEGES IN SCHEMA schema_name GRANT all ON ROUTINES TO "username@email.com";
ALTER DEFAULT PRIVILEGES IN SCHEMA schema_name GRANT all ON SEQUENCES TO "username@email.com";
ALTER DEFAULT PRIVILEGES IN SCHEMA schema_name GRANT all ON TABLES TO "username@email.com";
ALTER DEFAULT PRIVILEGES IN SCHEMA schema_name GRANT all ON types TO "username@email.com";
set session authorization "username@email.com";
reset session authorization;
【讨论】:
问题:是否可以通过 Terraform 向云 IAM 用户和服务帐户授予所需的权限?如果这些可以通过 TF 进行管理和跟踪,那就太好了,它比登录数据库和运行 SQL 命令具有更好的可见性......
【讨论】: