Skip to content

Commit

Permalink
Merge pull request #80 from Snowflake-Labs/sovereign-cloud-support
Browse files Browse the repository at this point in the history
Add support for sovereign cloud.
  • Loading branch information
sfc-gh-bkou authored Dec 17, 2024
2 parents b3ce926 + 9549c37 commit e69796e
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 14 deletions.
2 changes: 1 addition & 1 deletion ef_smtp.tf
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ resource "snowflake_external_function" "smtp_send" {
return_null_allowed = true
max_batch_rows = 1
api_integration = module.geff_snowalert[0].api_integration_name
url_of_proxy_and_resource = "${module.geff_snowalert[0].api_gateway_invoke_url}${var.env}/https"
url_of_proxy_and_resource = "${module.geff_snowalert[0].api_gateway_invoke_url}${var.env}/smtp"

return_type = "VARIANT"
return_behavior = "VOLATILE"
Expand Down
4 changes: 4 additions & 0 deletions functions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,10 @@ resource "snowflake_function_grant" "urlencode" {
var.ingest_role,
var.modeling_role,
]

depends_on = [
snowflake_function.urlencode,
]
}

resource "snowflake_function" "array_set" {
Expand Down
4 changes: 2 additions & 2 deletions geff.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module "geff_snowalert" {
count = length(var.handlers) > 0 ? 1 : 0
source = "Snowflake-Labs/api-integration-with-geff-aws/snowflake"
version = "0.3.6"
version = "0.3.7"

# Required
prefix = var.prefix
Expand All @@ -12,7 +12,6 @@ module "geff_snowalert" {

# AWS
aws_region = local.aws_region
arn_format = var.arn_format

# Other config items
geff_image_version = var.geff_image_version
Expand All @@ -22,6 +21,7 @@ module "geff_snowalert" {
providers = {
snowflake.api_integration_role = snowflake.api_integration_role
snowflake.storage_integration_role = snowflake.storage_integration_role
snowsql.storage_integration_role = snowsql.storage_integration_role
aws = aws
}
}
2 changes: 1 addition & 1 deletion grants.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module "snowalert_grants" {
source = "git@github.com:Snowflake-Labs/terraform-snowflake-snowalert-rbac.git?ref=v0.2.5"
source = "git::https://github.com/Snowflake-Labs/terraform-snowflake-snowalert-rbac.git?ref=v0.2.5"

snowalert_warehouse_name = var.snowalert_warehouse_name
snowalert_database_name = var.snowalert_database_name
Expand Down
6 changes: 6 additions & 0 deletions schemas.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ resource "snowflake_schema" "rules" {

database = local.snowalert_database_name
name = local.rules_schema_name

is_managed = var.use_managed_schema
}

locals {
Expand All @@ -36,6 +38,8 @@ resource "snowflake_schema" "results" {

database = local.snowalert_database_name
name = local.results_schema_name

is_managed = var.use_managed_schema
}

resource "snowflake_object_parameter" "results_schema_suspend_task_after_num_failures" {
Expand All @@ -61,6 +65,8 @@ resource "snowflake_schema" "monitoring" {

database = local.snowalert_database_name
name = local.monitoring_schema_name

is_managed = var.use_managed_schema
}

locals {
Expand Down
14 changes: 6 additions & 8 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,12 @@ variable "create_schemas" {
description = "Flag to create schemas within the module or not."
}

variable "use_managed_schema" {
type = bool
default = true
description = "Flag to create schemas within the module or not."
}

variable "create_tables" {
type = bool
default = false
Expand Down Expand Up @@ -256,12 +262,6 @@ variable "warehouse_external_roles" {
default = []
}

variable "arn_format" {
type = string
description = "ARN format could be aws or aws-us-gov. Defaults to non-gov."
default = "aws"
}

variable "jira_api_version" {
type = string
description = "Version of the JIRA API to use"
Expand All @@ -287,9 +287,7 @@ data "aws_partition" "current" {}
locals {
account_id = data.aws_caller_identity.current.account_id
aws_region = data.aws_region.current.name
}

locals {
snowalert_secret_arns = flatten([
contains(var.handlers, "jira") == true ? [var.jira_secrets_arn] : [],
contains(var.handlers, "slack") == true ? [var.slack_secrets_arn] : [],
Expand Down
13 changes: 11 additions & 2 deletions versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 4.38.0"
version = ">= 5.72.0"
}

snowflake = {
source = "Snowflake-Labs/snowflake"
version = ">= 0.62.0"
version = ">= 0.73.0"

configuration_aliases = [
snowflake.api_integration_role,
Expand All @@ -18,5 +18,14 @@ terraform {
snowflake.alerting_role,
]
}

snowsql = {
source = "aidanmelen/snowsql"
version = ">= 1.3.3"

configuration_aliases = [
snowsql.storage_integration_role,
]
}
}
}

0 comments on commit e69796e

Please sign in to comment.