You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I try to implement grant privilege including truncate I have the following error
Error: Invalid privileges list [select truncate update insert delete] for object of type table
on redshift_queries.tf line 82, in resource "redshift_grant" "data_group_tables":
82: resource "redshift_grant" "data_group_tables" {
If I comment the truncate privilege, everything goes fine.
Part of my code where I have the issue
# create data groupresource"redshift_group""data_group" {
depends_on=[aws_redshift_cluster.redshift_cluster]
name="DATA_USERS"users=[
redshift_user.data_user.name
]
}
# Init tables if neededresource"aws_redshiftdata_statement""init_tables" {
depends_on=[redshift_schema.schema]
for_each=local.sql_table_listcluster_identifier=aws_redshift_cluster.redshift_cluster.cluster_identifierdatabase=aws_redshift_cluster.redshift_cluster.database_namedb_user=aws_redshift_cluster.redshift_cluster.master_usernamestatement_name=replace(each.value.file_name, ".sql", "")
sql=file("templates/${each.value.file_name}")
}
# add grant on tablesresource"redshift_grant""data_group_tables" {
for_each=aws_redshiftdata_statement.init_tablesgroup=redshift_group.data_group.nameschema=redshift_schema.schema.nameobject_type="table"objects=[each.key]
privileges=[
"select",
"insert",
"delete",
"truncate",
"update"
]
}
Part of the solution (I guess)
After searching a bit in the code, I found that the error comes from the validatePrivileges function from the helpers.go file (L169 for the case "TABLE")
There are probably other stuff to do but I don't have really the time to investigate for now.
Hi,
according to the documentation at https://docs.aws.amazon.com/redshift/latest/dg/r_GRANT.html, the TRUNCATE privilege is only supported for roles in the form of GRANT TRUNCATE TABLE TO <role name>. The provider currently only supports users and groups, no support for roles/rbac.
I will close the issue in favor of #87 which is a feature request for RBAC/Roles support in the provider.
Goal
When I try to implement grant privilege including
truncate
I have the following errorIf I comment the
truncate
privilege, everything goes fine.Part of my code where I have the issue
Part of the solution (I guess)
After searching a bit in the code, I found that the error comes from the
validatePrivileges
function from thehelpers.go
file (L169 for thecase "TABLE"
)There are probably other stuff to do but I don't have really the time to investigate for now.
AWS doc
Part of the doc for the truncate privilege
Thank you for your feedback
The text was updated successfully, but these errors were encountered: