Snowflake-Labs / terraform-provider-snowflake

Terraform provider for managing Snowflake accounts
https://registry.terraform.io/providers/Snowflake-Labs/snowflake/latest
MIT License
548 stars 419 forks source link

[Feature]: New resource for Warehouse assignment to Resource Monitor #3019

Open jarach opened 2 months ago

jarach commented 2 months ago

Use Cases or Problem Statement

Any assignment to Resource Monitor requires ACCOUNTADMIN role. There is no "ALTER WAREHOUSE" in Snowflake-Labs provider, that can be executed separately with ACCOUNTADMIN role. It would be very convenient to have such option in order to:

Category

category:resource

Object type(s)

resource:resource_monitor, resource:warehouse

Proposal

Create a new resource for a resource assignment to a Resource Monitor

How much impact is this issue causing?

Low

Additional Information

Current workarounds are:

  1. create warehouse with desired/chosen role (to keep desired ownership) + use snowflake_unsafe_execute to alter warehouse (assign resource monitor with ACCOUNTADMIN)
  2. create warehouse (with resource assignment) using ACCOUNTADMIN + change ownership of the warehouse with snowflake_grant_ownership

Would you like to implement a fix?

sfc-gh-jcieslak commented 2 months ago

Hey @jarach 👋 Thank you for reporting this issue. I'll discuss it with the team and get back to you.

sfc-gh-jcieslak commented 1 month ago

Hey @jarach 👋 Still, the topic couldn't be discussed with the team for various reasons, but I'll get back to you when we go through this. For now, the workaround could be to use ignore changes on the resource_monitor field in warehouse resource (otherwise warehouse resource will try to unset the resource monitor on the warehouse) and set the resource monitor through unsafe_execute resource with ACCOUNTADMIN role.

sfc-gh-jcieslak commented 1 week ago

Hey @jarach During recent planning, we took the topic of "attachment" type resources as a whole. Since this is a bigger topic, we would like to discuss overall what our approach should be to such resources. Those discussions are postponed for now. For now, our main goal is to finish other bigger topics and focus on providing changes that contribute to the provider's V1 release.