brainly / terraform-provider-redshift

Terraform Redshift provider
https://registry.terraform.io/providers/brainly/redshift/latest/docs
MIT License
39 stars 49 forks source link

Add support for GRANT CREATE MODEL / GRANT EXECUTE ON MODEL #111

Open yauhen-sobaleu opened 1 year ago

yauhen-sobaleu commented 1 year ago

Hello!

I would like to use Redshift provider to grant privileges for in-database machine learning.

GRANT CREATE MODEL
    TO { username [ WITH GRANT OPTION ] | ROLE role_name | GROUP group_name | PUBLIC } [, ...]

GRANT { EXECUTE | ALL [ PRIVILEGES ] }
    ON MODEL model_name [, ...]

    TO { username [ WITH GRANT OPTION ] | ROLE role_name | GROUP group_name | PUBLIC } [, ...]
yauhen-sobaleu commented 1 year ago

If there is no time for this can you please give some hints on how I can add it myself? It should be straightforward since it's just a new resource.

winglot commented 1 year ago

Hi @yauhen-sobaleu I'm currently lacking the capacity to do the implementation. If you wish to implement it on your own and submit a PR, take a look at the redshift_grant resource: https://github.com/brainly/terraform-provider-redshift/blob/master/redshift/resource_redshift_grant.go

It will have to be extended to support a new object type. Most parts are pretty simple except for constructing a query that will extract and parse the privileges from Redshift itself.