Terraform module for Snowflake Resource Monitor management
- Creates Snowflake Resource Monitor
- Can create custom Snowflake Roles with role-to-role, role-to-user assignments
- Can create a set of default, functional roles to simplify access management:
ADMIN- full accessMODIFY- abillity to modify resource monitorMONITOR- abillity to monitor resource monitor
module "resource_monitors" {
source = "getindata/resource-monitor/snowflake"
name = "example_resource_monitor"
credit_quota = 50
notify_triggers = [50, 80, 90]
suspend_triggers = [100]
suspend_immediate_triggers = [110]
set_for_account = true
}Due to replacement of nulllabel (context.tf) with context provider, some breaking changes were introduced in v4.0.0 version of this module.
List of code and variable (API) changes:
- Removed
context.tffile (a single-file module with additional variables), which implied a removal of all its variables (exceptname):descriptor_formatslabel_value_caselabel_key_caseid_length_limitregex_replace_charslabel_orderadditional_tag_maptagslabels_as_tagsattributesdelimiterstageenvironmenttenantnamespaceenabledcontext
- Remove support
enabledflag - that might cause some backward compatibility issues with terraform state (please take into account that propermoveclauses were added to minimize the impact), but proceed with caution - Additional
contextprovider configuration - New variables were added, to allow naming configuration via
contextprovider:context_templatesname_schema
Additionally, due to breaking changes introduced in snowflake terraform provider v0.96.0 (snowflake_resource_monitor resource):
- Removal of
set_for_accountvariable / flag (will be settable on account resource) - Removal of
warehousesvariable (will be settable on warehouse resource)
-
Due to rename of Snowflake terraform provider source, all
versions.tffiles were updated accordingly.Please keep in mind to mirror this change in your own repos also.
For more information about provider rename, refer to Snowflake documentation.
| Name | Description | Type | Default | Required |
|---|---|---|---|---|
| context_templates | Map of context templates used for naming conventions - this variable supersedes naming_scheme.properties and naming_scheme.delimiter configuration |
map(string) |
{} |
no |
| create_default_roles | Whether the default roles should be created | bool |
false |
no |
| credit_quota | The number of credits allocated monthly to the resource monitor. | number |
null |
no |
| end_timestamp | The date and time when the resource monitor suspends the assigned warehouses. | string |
null |
no |
| frequency | The frequency interval at which the credit usage resets to 0. If you set a frequency for a resource monitor, you must also set START_TIMESTAMP. | string |
null |
no |
| name | Name of the resource | string |
n/a | yes |
| name_scheme | Naming scheme configuration for the resource. This configuration is used to generate names using context provider: - properties - list of properties to use when creating the name - is superseded by var.context_templates- delimiter - delimited used to create the name from properties - is superseded by var.context_templates- context_template_name - name of the context template used to create the name- replace_chars_regex - regex to use for replacing characters in property-values created by the provider - any characters that match the regex will be removed from the name- extra_values - map of extra label-value pairs, used to create a name- uppercase - convert name to uppercase |
object({ |
{} |
no |
| notify_triggers | A list of percentage thresholds at which to send an alert to subscribed users. | list(number) |
null |
no |
| notify_users | Specifies the list of users to receive email notifications on resource monitors. | list(string) |
null |
no |
| roles | Roles created on the Resource Monitor level | map(object({ |
{} |
no |
| start_timestamp | The date and time when the resource monitor starts monitoring credit usage for the assigned warehouses. | string |
null |
no |
| suspend_immediate_trigger | The number that represents the percentage threshold at which to immediately suspend all warehouses. | number |
null |
no |
| suspend_trigger | The number that represents the percentage threshold at which to suspend all warehouses. | number |
null |
no |
| Name | Source | Version |
|---|---|---|
| roles_deep_merge | Invicton-Labs/deepmerge/null | 0.1.5 |
| snowflake_custom_role | getindata/role/snowflake | 4.0.0 |
| snowflake_default_role | getindata/role/snowflake | 4.0.0 |
| Name | Description |
|---|---|
| credit_quota | The number of credits allocated monthly to the resource monitor |
| end_timestamp | The date and time when the resource monitor suspends the assigned warehouses |
| frequency | The frequency interval at which the credit usage resets to 0 |
| name | Name of resource monitor |
| notify_triggers | A list of percentage thresholds at which to send an alert to subscribed users |
| notify_users | A list of users to receive email notifications on resource monitors |
| roles | Access roles created for resource monitor |
| start_timestamp | The date and time when the resource monitor starts monitoring credit usage |
| suspend_immediate_triggers | A list of percentage thresholds at which to immediately suspend all warehouses |
| suspend_triggers | A list of percentage thresholds at which to suspend all warehouses |
| Name | Version |
|---|---|
| context | >=0.4.0 |
| snowflake | >= 0.96 |
| Name | Version |
|---|---|
| terraform | >= 1.3 |
| context | >=0.4.0 |
| snowflake | >= 0.96 |
| Name | Type |
|---|---|
| snowflake_resource_monitor.this | resource |
| context_label.this | data source |
Contributions are very welcomed!
Start by reviewing contribution guide and our code of conduct. After that, start coding and ship your changes by creating a new PR.
Apache 2 Licensed. See LICENSE for full details.
Made with contrib.rocks.