Skip to content

Commit

Permalink
Merge pull request #68 from Snowflake-Labs/refactor-for-public
Browse files Browse the repository at this point in the history
Refactor to make public
  • Loading branch information
sfc-gh-bkou authored Jul 7, 2023
2 parents fbc00f8 + 349ac69 commit a29fe6e
Show file tree
Hide file tree
Showing 24 changed files with 149 additions and 148 deletions.
4 changes: 2 additions & 2 deletions account_level_objects.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Warehouse
resource "snowflake_warehouse" "snowalert" {
count = var.create_warehouse == true ? 1 : 0
provider = snowflake.security_admin_role
provider = snowflake.admin_role

name = upper(trimspace(var.snowalert_warehouse_name))
comment = "Warehouse that will be used for Snowalert."
Expand All @@ -18,7 +18,7 @@ locals {
# Database
resource "snowflake_database" "snowalert" {
count = var.create_database == true ? 1 : 0
provider = snowflake.security_admin_role
provider = snowflake.admin_role

name = upper(trimspace(var.snowalert_database_name))
comment = "Snowalert Database."
Expand Down
4 changes: 2 additions & 2 deletions ef_jira.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
resource "snowflake_external_function" "snowalert_jira_api" {
count = contains(var.handlers, "jira") == true ? 1 : 0
provider = snowflake.security_alerting_role
provider = snowflake.alerting_role

database = local.snowalert_database_name
schema = local.results_schema
Expand Down Expand Up @@ -82,7 +82,7 @@ COMMENT

resource "snowflake_function" "jira_handler" {
count = contains(var.handlers, "jira") == true ? 1 : 0
provider = snowflake.security_alerting_role
provider = snowflake.alerting_role

name = "JIRA_HANDLER"
database = local.snowalert_database_name
Expand Down
2 changes: 1 addition & 1 deletion ef_servicenow.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
resource "snowflake_external_function" "servicenow_create_incident" {
count = contains(var.handlers, "servicenow") == true ? 1 : 0
provider = snowflake.security_alerting_role
provider = snowflake.alerting_role

database = local.snowalert_database_name
schema = local.results_schema
Expand Down
6 changes: 3 additions & 3 deletions ef_slack.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
resource "snowflake_external_function" "slack_snowflake" {
count = contains(var.handlers, "slack") == true ? 1 : 0
provider = snowflake.security_alerting_role
provider = snowflake.alerting_role

database = local.snowalert_database_name
schema = local.results_schema
Expand Down Expand Up @@ -81,7 +81,7 @@ locals {

resource "snowflake_function" "slack_snowflake_chat_post_message" {
count = contains(var.handlers, "slack") == true ? 1 : 0
provider = snowflake.security_alerting_role
provider = snowflake.alerting_role

name = "SLACK_SNOWFLAKE_CHAT_POST_MESSAGE"
database = local.snowalert_database_name
Expand Down Expand Up @@ -125,7 +125,7 @@ locals {

resource "snowflake_function" "slack_handler" {
count = contains(var.handlers, "slack") == true ? 1 : 0
provider = snowflake.security_alerting_role
provider = snowflake.alerting_role

database = local.snowalert_database_name
schema = local.results_schema
Expand Down
6 changes: 3 additions & 3 deletions ef_smtp.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
resource "snowflake_external_function" "smtp_send" {
count = contains(var.handlers, "smtp") == true ? 1 : 0
provider = snowflake.security_alerting_role
provider = snowflake.alerting_role

database = local.snowalert_database_name
schema = local.results_schema
Expand Down Expand Up @@ -75,7 +75,7 @@ locals {

resource "snowflake_function" "smtp_handler" {
count = contains(var.handlers, "smtp") == true ? 1 : 0
provider = snowflake.security_alerting_role
provider = snowflake.alerting_role

database = local.snowalert_database_name
schema = local.results_schema
Expand Down Expand Up @@ -116,7 +116,7 @@ locals {

resource "snowflake_function" "smtp_handler_1_arg" {
count = contains(var.handlers, "smtp") == true ? 1 : 0
provider = snowflake.security_alerting_role
provider = snowflake.alerting_role

database = local.snowalert_database_name
schema = local.results_schema
Expand Down
28 changes: 14 additions & 14 deletions examples/complete/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ module "snowalert" {

snowalert_warehouse_size = var.snowalert_warehouse_size
snowflake_integration_user_roles = [
var.security_ingest_role,
var.security_alerting_role,
var.security_modeling_role,
var.ingest_role,
var.alerting_role,
var.modeling_role,
]

snowalert_warehouse_name = var.snowalert_warehouse_name
Expand All @@ -26,12 +26,12 @@ module "snowalert" {

create_tables = var.create_tables

security_integration_role = var.security_integration_role
security_admin_role = var.security_admin_role
security_alerting_role = var.security_alerting_role
security_ingest_role = var.security_ingest_role
security_modeling_role = var.security_modeling_role
security_monitoring_role = var.security_monitoring_role
integration_role = var.integration_role
admin_role = var.admin_role
alerting_role = var.alerting_role
ingest_role = var.ingest_role
modeling_role = var.modeling_role
monitoring_role = var.monitoring_role

handlers = var.handlers
slack_secrets_arn = var.slack_secrets_arn
Expand All @@ -48,10 +48,10 @@ module "snowalert" {
servicenow_api_url = var.servicenow_api_url

providers = {
snowflake.security_api_integration_role = snowflake.security_api_integration_role
snowflake.security_storage_integration_role = snowflake.security_storage_integration_role
snowflake.security_admin_role = snowflake.security_admin_role
snowflake.security_alerting_role = snowflake.security_alerting_role
aws = aws
snowflake.api_integration_role = snowflake.api_integration_role
snowflake.storage_integration_role = snowflake.storage_integration_role
snowflake.admin_role = snowflake.admin_role
snowflake.alerting_role = snowflake.alerting_role
aws = aws
}
}
16 changes: 8 additions & 8 deletions examples/complete/snowflake_provider.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,29 @@
# export SNOWFLAKE_PRIVATE_KEY_PASSPHRASE="snowflake_passphrase"

provider "snowflake" {
alias = "security_api_integration_role"
alias = "api_integration_role"

account = var.snowflake_account
role = var.security_integration_role
role = var.integration_role
}

provider "snowflake" {
alias = "security_storage_integration_role"
alias = "storage_integration_role"

account = var.snowflake_account
role = var.security_integration_role
role = var.integration_role
}

provider "snowflake" {
alias = "security_admin_role"
alias = "admin_role"

account = var.snowflake_account
role = var.security_admin_role
role = var.admin_role
}

provider "snowflake" {
alias = "security_alerting_role"
alias = "alerting_role"

account = var.snowflake_account
role = var.security_alerting_role
role = var.alerting_role
}
12 changes: 6 additions & 6 deletions examples/complete/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -198,37 +198,37 @@ variable "monitoring_schema_name" {
default = "MONITORING"
}

variable "security_integration_role" {
variable "integration_role" {
type = string
description = "Role for creating database level or account level objects."
default = "ACCOUNTADMIN"
}

variable "security_admin_role" {
variable "admin_role" {
type = string
description = "Role for creating database level or account level objects."
default = "ACCOUNTADMIN"
}

variable "security_alerting_role" {
variable "alerting_role" {
type = string
description = "Role for creating schema level objects."
default = "ACCOUNTADMIN"
}

variable "security_ingest_role" {
variable "ingest_role" {
type = string
description = "Role for creating schema level objects."
default = "ACCOUNTADMIN"
}

variable "security_modeling_role" {
variable "modeling_role" {
type = string
description = "Role for creating schema level objects."
default = "ACCOUNTADMIN"
}

variable "security_monitoring_role" {
variable "monitoring_role" {
type = string
description = "Role for creating schema level objects."
default = "ACCOUNTADMIN"
Expand Down
4 changes: 2 additions & 2 deletions examples/complete/versions.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
terraform {
required_version = "~> 1.3.4"
required_version = "~> 1.4.6"

required_providers {
aws = {
Expand All @@ -9,7 +9,7 @@ terraform {

snowflake = {
source = "Snowflake-Labs/snowflake"
version = "~> 0.57.0"
version = "~> 0.66.1"
}
}
}
11 changes: 6 additions & 5 deletions examples/simple/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@ module "snowalert" {
snowalert_user_email = var.snowalert_user_email
create_tables = var.create_tables
handlers = var.handlers
slack_secrets_arn = var.slack_secrets_arn

providers = {
snowflake.security_api_integration_role = snowflake.security_api_integration_role
snowflake.security_storage_integration_role = snowflake.security_storage_integration_role
snowflake.security_admin_role = snowflake.security_admin_role
snowflake.security_alerting_role = snowflake.security_alerting_role
aws = aws
snowflake.api_integration_role = snowflake.api_integration_role
snowflake.storage_integration_role = snowflake.storage_integration_role
snowflake.admin_role = snowflake.admin_role
snowflake.alerting_role = snowflake.alerting_role
aws = aws
}
}
16 changes: 8 additions & 8 deletions examples/simple/snowflake_provider.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,29 @@
# export SNOWFLAKE_PRIVATE_KEY_PASSPHRASE="snowflake_passphrase"

provider "snowflake" {
alias = "security_api_integration_role"
alias = "api_integration_role"

account = var.snowflake_account
role = var.security_integration_role
role = var.integration_role
}

provider "snowflake" {
alias = "security_storage_integration_role"
alias = "storage_integration_role"

account = var.snowflake_account
role = var.security_integration_role
role = var.integration_role
}

provider "snowflake" {
alias = "security_admin_role"
alias = "admin_role"

account = var.snowflake_account
role = var.security_admin_role
role = var.admin_role
}

provider "snowflake" {
alias = "security_alerting_role"
alias = "alerting_role"

account = var.snowflake_account
role = var.security_alerting_role
role = var.alerting_role
}
12 changes: 6 additions & 6 deletions examples/simple/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -174,37 +174,37 @@ variable "alert_scheduler_schedule" {
default = "1/15 * * * *"
}

variable "security_integration_role" {
variable "integration_role" {
type = string
description = "Role for creating database level or account level objects."
default = "ACCOUNTADMIN"
}

variable "security_admin_role" {
variable "admin_role" {
type = string
description = "Role for creating database level or account level objects."
default = "ACCOUNTADMIN"
}

variable "security_alerting_role" {
variable "alerting_role" {
type = string
description = "Role for creating schema level objects."
default = "ACCOUNTADMIN"
}

variable "security_ingest_role" {
variable "ingest_role" {
type = string
description = "Role for creating schema level objects."
default = "ACCOUNTADMIN"
}

variable "security_modeling_role" {
variable "modeling_role" {
type = string
description = "Role for creating schema level objects."
default = "ACCOUNTADMIN"
}

variable "security_monitoring_role" {
variable "monitoring_role" {
type = string
description = "Role for creating schema level objects."
default = "ACCOUNTADMIN"
Expand Down
4 changes: 2 additions & 2 deletions examples/simple/versions.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
terraform {
required_version = "~> 1.3.4"
required_version = "~> 1.4.6"

required_providers {
aws = {
Expand All @@ -9,7 +9,7 @@ terraform {

snowflake = {
source = "Snowflake-Labs/snowflake"
version = "~> 0.57.0"
version = "~> 0.66.1"
}
}
}
Loading

0 comments on commit a29fe6e

Please sign in to comment.