通过Terrafrom的授予特权和权限不起作用
根据Terraform Doc的说法,我创建了一个用户和角色,如下所示:
resource "postgresql_role" "ro_role" {
name = "ro_role"
}
resource "postgresql_role" "ro_user" {
name = "ro_user"
login = true
password = "some sensitive password"
}
它是成功创建的。
接下来,当尝试掌握角色的权限时,例如,仅添加 的Readonly角色,它根本不会添加任何特权。另外,当登录到Postgres并尝试选择
查询时,它会给我一个权限拒绝错误。
resource "postgresql_grant" "readonly_tables" {
database = var.database
role = "ro_role"
schema = "public"
object_type = "table"
objects = []
privileges = ["SELECT"]
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可能没有在公共架构上授予自己
使用
。根据您提供的文档,您需要定义一个资源,例如:postgresql_role.ro_user资源也没有掩盖ro_role。您将需要此功能,使RO_USER实际上将权限分配给RO_ROLE:
You likely didn't grant yourself
USAGE
on the public schema. Based on the docs you provided, you'll need to define a resource like:the postgresql_role.ro_user resources is also not assinged the ro_role. You will need this for ro_user to actually have the permissions assigned to ro_role: