-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(terraform): add snowflake warehouse, database, schema, role (#15…
…709)
- Loading branch information
1 parent
16fe197
commit 9af57b5
Showing
77 changed files
with
324 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
12 changes: 12 additions & 0 deletions
12
cloud-infrastructure/terraform/modules/snowflake/hm_snowflake_database/main.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
terraform { | ||
required_providers { | ||
snowflake = { | ||
source = "Snowflake-Labs/snowflake" | ||
} | ||
} | ||
} | ||
|
||
# https://registry.terraform.io/providers/Snowflake-Labs/snowflake/latest/docs/resources/database | ||
resource "snowflake_database" "hm_snowflake_database" { | ||
name = var.snowflake_database_name | ||
} |
3 changes: 3 additions & 0 deletions
3
cloud-infrastructure/terraform/modules/snowflake/hm_snowflake_database/outputs.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
output "name" { | ||
value = var.snowflake_database_name | ||
} |
3 changes: 3 additions & 0 deletions
3
cloud-infrastructure/terraform/modules/snowflake/hm_snowflake_database/variables.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
variable "snowflake_database_name" { | ||
type = string | ||
} |
18 changes: 18 additions & 0 deletions
18
...snowflake/hm_snowflake_grant_privileges_to_account_role_grant_database_privileges/main.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
terraform { | ||
required_providers { | ||
snowflake = { | ||
source = "Snowflake-Labs/snowflake" | ||
} | ||
} | ||
} | ||
|
||
# https://registry.terraform.io/providers/Snowflake-Labs/snowflake/latest/docs/resources/grant_privileges_to_account_role | ||
# https://quickstarts.snowflake.com/guide/terraforming_snowflake/index.html#8 | ||
resource "snowflake_grant_privileges_to_account_role" "hm_snowflake_grant_privileges_to_account_role_grant_database_privileges" { | ||
account_role_name = var.account_role_name | ||
privileges = var.privileges | ||
on_account_object { | ||
object_type = "DATABASE" | ||
object_name = var.snowflake_database_name | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
...lake/hm_snowflake_grant_privileges_to_account_role_grant_database_privileges/variables.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
variable "account_role_name" { | ||
type = string | ||
} | ||
variable "privileges" { | ||
type = list(string) | ||
} | ||
variable "snowflake_database_name" { | ||
type = string | ||
} |
17 changes: 17 additions & 0 deletions
17
...s/snowflake/hm_snowflake_grant_privileges_to_account_role_grant_schema_privileges/main.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
terraform { | ||
required_providers { | ||
snowflake = { | ||
source = "Snowflake-Labs/snowflake" | ||
} | ||
} | ||
} | ||
|
||
# https://registry.terraform.io/providers/Snowflake-Labs/snowflake/latest/docs/resources/grant_privileges_to_account_role | ||
# https://quickstarts.snowflake.com/guide/terraforming_snowflake/index.html#8 | ||
resource "snowflake_grant_privileges_to_account_role" "hm_snowflake_grant_privileges_to_account_role_grant_schema_privileges" { | ||
account_role_name = var.account_role_name | ||
privileges = var.privileges | ||
on_schema { | ||
schema_name = "\"${var.snowflake_database_name}\".\"${var.snowflake_schema_name}\"" | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
...wflake/hm_snowflake_grant_privileges_to_account_role_grant_schema_privileges/variables.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
variable "account_role_name" { | ||
type = string | ||
} | ||
variable "privileges" { | ||
type = list(string) | ||
} | ||
variable "snowflake_database_name" { | ||
type = string | ||
} | ||
variable "snowflake_schema_name" { | ||
type = string | ||
} |
18 changes: 18 additions & 0 deletions
18
...nowflake/hm_snowflake_grant_privileges_to_account_role_grant_warehouse_privileges/main.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
terraform { | ||
required_providers { | ||
snowflake = { | ||
source = "Snowflake-Labs/snowflake" | ||
} | ||
} | ||
} | ||
|
||
# https://registry.terraform.io/providers/Snowflake-Labs/snowflake/latest/docs/resources/grant_privileges_to_account_role | ||
# https://quickstarts.snowflake.com/guide/terraforming_snowflake/index.html#8 | ||
resource "snowflake_grant_privileges_to_account_role" "hm_snowflake_grant_privileges_to_account_role_grant_warehouse_privileges" { | ||
account_role_name = var.account_role_name | ||
privileges = var.privileges | ||
on_account_object { | ||
object_type = "WAREHOUSE" | ||
object_name = var.snowflake_warehouse_name | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
...ake/hm_snowflake_grant_privileges_to_account_role_grant_warehouse_privileges/variables.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
variable "account_role_name" { | ||
type = string | ||
} | ||
variable "privileges" { | ||
type = list(string) | ||
} | ||
variable "snowflake_warehouse_name" { | ||
type = string | ||
} |
12 changes: 12 additions & 0 deletions
12
cloud-infrastructure/terraform/modules/snowflake/hm_snowflake_role/main.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
terraform { | ||
required_providers { | ||
snowflake = { | ||
source = "Snowflake-Labs/snowflake" | ||
} | ||
} | ||
} | ||
|
||
# https://registry.terraform.io/providers/Snowflake-Labs/snowflake/latest/docs/resources/role | ||
resource "snowflake_role" "hm_snowflake_role" { | ||
name = var.snowflake_role_name | ||
} |
3 changes: 3 additions & 0 deletions
3
cloud-infrastructure/terraform/modules/snowflake/hm_snowflake_role/outputs.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
output "name" { | ||
value = var.snowflake_role_name | ||
} |
3 changes: 3 additions & 0 deletions
3
cloud-infrastructure/terraform/modules/snowflake/hm_snowflake_role/variables.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
variable "snowflake_role_name" { | ||
type = string | ||
} |
16 changes: 16 additions & 0 deletions
16
cloud-infrastructure/terraform/modules/snowflake/hm_snowflake_schema/main.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
terraform { | ||
required_providers { | ||
snowflake = { | ||
source = "Snowflake-Labs/snowflake" | ||
} | ||
} | ||
} | ||
|
||
# https://registry.terraform.io/providers/Snowflake-Labs/snowflake/latest/docs/resources/schema | ||
resource "snowflake_schema" "hm_snowflake_schema" { | ||
database = var.snowflake_database_name | ||
name = var.snowflake_schema_name | ||
is_managed = false | ||
is_transient = false | ||
data_retention_days = 7 | ||
} |
3 changes: 3 additions & 0 deletions
3
cloud-infrastructure/terraform/modules/snowflake/hm_snowflake_schema/outputs.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
output "name" { | ||
value = var.snowflake_schema_name | ||
} |
6 changes: 6 additions & 0 deletions
6
cloud-infrastructure/terraform/modules/snowflake/hm_snowflake_schema/variables.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
variable "snowflake_schema_name" { | ||
type = string | ||
} | ||
variable "snowflake_database_name" { | ||
type = string | ||
} |
14 changes: 14 additions & 0 deletions
14
cloud-infrastructure/terraform/modules/snowflake/hm_snowflake_warehouse/main.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
terraform { | ||
required_providers { | ||
snowflake = { | ||
source = "Snowflake-Labs/snowflake" | ||
} | ||
} | ||
} | ||
|
||
# https://registry.terraform.io/providers/Snowflake-Labs/snowflake/latest/docs/resources/warehouse | ||
resource "snowflake_warehouse" "hm_snowflake_warehouse" { | ||
name = var.snowflake_warehouse_name | ||
warehouse_size = var.snowflake_warehouse_size | ||
auto_suspend = var.auto_suspend_s | ||
} |
3 changes: 3 additions & 0 deletions
3
cloud-infrastructure/terraform/modules/snowflake/hm_snowflake_warehouse/outputs.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
output "name" { | ||
value = var.snowflake_warehouse_name | ||
} |
9 changes: 9 additions & 0 deletions
9
cloud-infrastructure/terraform/modules/snowflake/hm_snowflake_warehouse/variables.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
variable "snowflake_warehouse_name" { | ||
type = string | ||
} | ||
variable "snowflake_warehouse_size" { | ||
type = string | ||
} | ||
variable "auto_suspend_s" { | ||
type = number | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters