Skip to content

Richard-Barrett/terraform-snowflake-warehouses

Repository files navigation

terraform-snowflake-warehouses module

This is a repository that makes a warehouse with bare-minimum specs with the following defaults:

  • Clustering
  • Size X-SMALL
  • Query Limitations and Timeouts
  • Query Acceleration
  • Warehouse Type Standard

Example CICD with BitBucket and Codefresh:

Image

NOTES

WARNING:

  • BREAKING CHANGES OCCUR FROM 0.11.0 TO 0.12.0 THE SNOWFLAKE PROVIDER VERSON UPGRADES FROM 93.X.X TO 1.0.1 HAD SOME CHANGES IN THE OVERALL NAMING CONVENTIONS AND LOGIC FOR MAKINMG WAREHOUSE ROLES

Usage

To use the module you will need to use the following:

module "snowflake_warehouse_bi" {
  source = "git::https://github.com/Richard-Barrett/terraform-snowflake-warehouses.git?ref=0.0.1"

  warehouse_name    = "BI"
  warehouse_comment = "Business Intelligences Warehouse"    # Optional
}

Required Values:

Values
warehouse_name
resource_monitor

What if you want to specify specific components in the warehouse?

module "snowflake_warehouse_bi" {
  source  = "git::https://github.com/Richard-Barrett/terraform-snowflake-warehouses.git?ref=0.0.1"

  warehouse_size    = "medium"
  warehouse_name    = "BI"
  warehouse_comment = "Business Intelligences Warehouse"    # Optional
  resource_monitor  = "BI"                                  # Optional
}

In the above we reference the following fields in addition to the required field warehouse_name:

  • warehouse_size: The size of the warehouse
  • warehouse_comment: A description for the Warehouse
  • resource_monitor: A resource monitor for the warehouse getting created

Overview

In overview, this repository acts as a digestible module that allows you to create a warehouse, the warehouse role, and the warehouse grant.

Requirements

Name Version
terraform >= 1.3.6
snowflake ~> 1.0.1

Providers

Name Version
snowflake 1.0.1

Modules

No modules.

Resources

Name Type
snowflake_account_role.this resource
snowflake_grant_privileges_to_account_role.this resource
snowflake_resource_monitor.this resource
snowflake_warehouse.this resource

Inputs

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 200 no
credit_quota Credit Quota for Warehouse number 100 no
max_cluster_count Specifies the maximum number of server clusters for the warehouse. number "2" no
max_concurrency_level Object parameter that specifies the concurrency level for SQL statements (i.e. queries and DML) executed by a warehouse. number 8 no
min_cluster_count Specifies the minimum number of server clusters for the warehouse (only applies to multi-cluster warehouses). number "1" 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 "3" no
resource_monitor Specifies the name of a resource monitor that is explicitly assigned to the warehouse. string n/a yes
statement_queued_timeout_in_seconds Specifies the time, in seconds, after which a running SQL statement (query, DDL, DML, etc.) is canceled by the system number 3600 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 3600 no
warehouse_comment Comment for the warehouse or added description of warehouse string "" no
warehouse_name Name of the Warehouse you want to make string n/a yes
warehouse_size Specifies the size of the virtual warehouse. Larger warehouse sizes 5X-Large and 6X-Large are currently in preview and only available on Amazon Web Services (AWS). string "X-SMALL" no
warehouse_type Specifies a STANDARD or SNOWPARK-OPTIMIZED warehouse string "STANDARD" no
with_grant_option When this is set to true, allows the recipient role to grant the privileges to other roles. bool false no

Outputs

Name Description
role_name Snowflake Role that is used to access the warehouse that the module creates

About

A Terraform Module for Making Snowflake Warehouses

Resources

License

Stars

Watchers

Forks

Packages

No packages published