Terraform module for Snowflake Warehouse management
- Creates Snowflake Warehouse
- 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 accessMONITOR
- abillity to monitor warehouseUSAGE
- abillity to use warehouse
module "terraform_snowflake_warehouse" {
source = "getindata/warehouse/snowflake"
context = module.this.context
name = "warehouse"
comment = "My Warehouse"
warehouse_size = "x-small"
auto_resume = true
auto_suspend = 600
initially_suspended = true
create_default_roles = true
roles = {
admin = {
granted_to_roles = ["SYSADMIN"]
}
}
}
When upgrading to version v2.2.x
- all default_roles
will be recreated using new terraform resources.
Due to replacement of nulllabel (context.tf
) with context provider, some breaking changes were introduced in v3.0.0
version of this module.
List od code and variable (API) changes:
- Removed
context.tf
file (a single-file module with additonal variables), which implied a removal of all its variables (exceptname
):descriptor_formats
label_value_case
label_key_case
id_length_limit
regex_replace_chars
label_order
additional_tag_map
tags
labels_as_tags
attributes
delimiter
stage
environment
tenant
namespace
enabled
context
- Remove support
enabled
flag - that might cause some backward compatibility issues with terraform state (please take into account that propermove
clauses were added to minimize the impact), but proceed with caution - Additional
context
provider configuration - New variables were added, to allow naming configuration via
context
provider:context_templates
name_schema
-
Due to rename of Snowflake terraform provider source, all
versions.tf
files 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 |
---|---|---|---|---|
auto_resume | Specifies whether to automatically resume a warehouse when a SQL statement (e.g. query) is submitted to it. | bool |
true |
no |
auto_suspend | Specifies the number of seconds of inactivity after which a warehouse is automatically suspended. | number |
null |
no |
comment | Warehouse comment/description. | string |
null |
no |
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 |
enable_query_acceleration | Specifies whether to enable the query acceleration service for queries that rely on this warehouse for compute resources. | bool |
true |
no |
initially_suspended | Specifies whether the warehouse is created initially in the ‘Suspended’ state. | bool |
true |
no |
max_cluster_count | Specifies the maximum number of server clusters for the warehouse. | number |
1 |
no |
max_concurrency_level | Object parameter that specifies the concurrency level for SQL statements (i.e. queries and DML) executed by a warehouse. | number |
null |
no |
min_cluster_count | Specifies the minimum number of server clusters for the warehouse (only applies to multi-cluster warehouses). | number |
1 |
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 |
query_acceleration_max_scale_factor | Specifies the maximum scale factor for leasing compute resources for query acceleration. The scale factor is used as a multiplier based on warehouse size. | number |
null |
no |
resource_monitor | Specifies the name of a resource monitor that is explicitly assigned to the warehouse. | string |
null |
no |
roles | Account roles created on the warehouse level | map(object({ |
{} |
no |
scaling_policy | Specifies the policy for automatically starting and shutting down clusters in a multi-cluster warehouse running in Auto-scale mode. Valid values are STANDARD and ECONOMY . |
string |
null |
no |
statement_queued_timeout_in_seconds | Object parameter that specifies the time, in seconds, a SQL statement (query, DDL, DML, etc.) can be queued on a warehouse before it is canceled by the system. | number |
null |
no |
statement_timeout_in_seconds | Specifies the time, in seconds, after which a running SQL statement (query, DDL, DML, etc.) is canceled by the system | number |
null |
no |
warehouse_size | Specifies the size of the virtual warehouse. Possible values are: XSMALL, X-SMALL, SMALL, MEDIUM, LARGE, XLARGE, X-LARGE, XXLARGE, X2LARGE, 2X-LARGE, XXXLARGE, X3LARGE, 3X-LARGE, X4LARGE, 4X-LARGE, X5LARGE, 5X-LARGE, X6LARGE, 6X-LARGE. | string |
"X-Small" |
no |
warehouse_type | Specifies the type of the virtual warehouse. | string |
"STANDARD" |
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 |
---|---|
roles | Access roles created for warehouse |
warehouse | Details of the warehouse |
Name | Version |
---|---|
context | >=0.4.0 |
snowflake | >= 0.95 |
Name | Version |
---|---|
terraform | >= 1.3 |
context | >=0.4.0 |
snowflake | >= 0.95 |
Name | Type |
---|---|
snowflake_warehouse.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.