Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clone database with permissions #2321

Closed
javierpe27 opened this issue Jan 5, 2024 · 8 comments
Closed

Clone database with permissions #2321

javierpe27 opened this issue Jan 5, 2024 · 8 comments
Labels
category:resource feature-request Used to mark issues with provider's missing functionalities resource:database Issue connected to the snowflake_database resource

Comments

@javierpe27
Copy link

Terraform CLI and Provider Versions

Terraform CLI version 1.6.6
Provider version = 0.37.1

Use Cases or Problem Statement

I am trying to create several zero copy clones from an existing database. To do that I am using the resource snowflake_database, specifying in the field "from_database" the database I want to clone from. In addition, I would also like to clone the grants of that database, similar to what snowflake already provides out of the box with COPY GRANTS

Proposal

Could you add a feature to allow copying all the grants from an existing database to another one? This will save us a lot of resources assigning all the roles to the clones again. It could be a new parameter in the snowflake_database resource, or a brand new resource, up to you.

How much impact is this issue causing?

High

Additional Information

No response

@javierpe27 javierpe27 added the feature-request Used to mark issues with provider's missing functionalities label Jan 5, 2024
@sfc-gh-asawicki
Copy link
Collaborator

Hey @javierpe27. Thanks for creating the issue.

One of the next items on our roadmap is to align the existing resources with the underlying functionalities of Snowflake. Supporting the CLONEs properly is one of the topics there. We will return to this topic when we reach this item on the roadmap.

@javierpe27
Copy link
Author

javierpe27 commented Jan 10, 2024 via email

@sfc-gh-asawicki
Copy link
Collaborator

Hey @javierpe27. We have yet to set an estimate we can share. To be clear, we will first discuss how the cloning functionality aligns with the terraform ideology, which objects should support it, etc. We will share the discussions with the community as soon as we get there.

Currently, what you can do now, for almost every missing feature is to use the snowflake_unsafe_execute resource. It has some limitations, though. Please be sure to familiarize yourself with the docs before using it.

@javierpe27
Copy link
Author

javierpe27 commented Jan 10, 2024

Thanks for your help @sfc-gh-asawicki !

@sfc-gh-jcieslak sfc-gh-jcieslak added resource:database Issue connected to the snowflake_database resource category:resource labels May 20, 2024
@sfc-gh-jcieslak
Copy link
Collaborator

Hey @javierpe27 👋
I don't know if saw this, but we added an entry on object cloning to our v1 changes list. We would like to postpone it as there are some other solutions provided by the provider and Terraform and currently we are focusing on essential features for V1.

Could you give more insight (that we will need in research/discussions after v1) into why cloning is important for you and how is it different from regular for_each with the same configuration on the side of terraform?
cc: @kamilamarcinekpgs (adding you for additional input if possible, since you had the same feature request)

@kanomaxb
Copy link

We needed cloning because there was no way to remove the public schema. Our solution was to create manually one empty "model" database, with public schema removed and other desired settings applied, to use it as a template to create all other databases by cloning (tried to mimic SQL Server behavior).

I am aware that you are working on the possibility to drop the public schema right after creation now, so we will no longer need cloning.

@sfc-gh-jcieslak
Copy link
Collaborator

Thanks, @kamilamarcinekpgs. It's currently possible to drop them on create (https://registry.terraform.io/providers/Snowflake-Labs/snowflake/latest/docs/resources/database#drop_public_schema_on_creation).

@sfc-gh-jcieslak
Copy link
Collaborator

Closing due to long inactivity + as mentioned object cloning will be considered in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:resource feature-request Used to mark issues with provider's missing functionalities resource:database Issue connected to the snowflake_database resource
Projects
None yet
Development

No branches or pull requests

4 participants