diff --git a/examples/complete/main.tf b/examples/complete/main.tf index 73080fd..3e23eb3 100644 --- a/examples/complete/main.tf +++ b/examples/complete/main.tf @@ -6,7 +6,6 @@ module "storage_integration" { env = var.env # AWS - arn_format = var.arn_format data_bucket_arns = var.data_bucket_arns # Snowflake @@ -15,6 +14,7 @@ module "storage_integration" { providers = { snowflake.storage_integration_role = snowflake.storage_integration_role + snowsql.storage_integration_role = snowsql.storage_integration_role aws = aws } } diff --git a/examples/complete/snowsql_provider.tf b/examples/complete/snowsql_provider.tf new file mode 100644 index 0000000..0ef8961 --- /dev/null +++ b/examples/complete/snowsql_provider.tf @@ -0,0 +1,7 @@ +provider "snowsql" { + alias = "storage_integration_role" + + account = var.snowflake_account + role = var.snowflake_storage_integration_owner_role + username = "example_user" +} diff --git a/examples/complete/versions.tf b/examples/complete/versions.tf index 616d4b5..7c11a4c 100644 --- a/examples/complete/versions.tf +++ b/examples/complete/versions.tf @@ -4,12 +4,17 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = "~> 4.38.0" + version = "~> 5.72.0" } snowflake = { source = "Snowflake-Labs/snowflake" - version = "~> 0.64.0" + version = "~> 0.73.0" + } + + snowsql = { + source = "aidanmelen/snowsql" + version = "~> 1.3.3" } } } diff --git a/storage_integration.tf b/storage_integration.tf index 7a93c0d..881be5e 100644 --- a/storage_integration.tf +++ b/storage_integration.tf @@ -55,9 +55,9 @@ resource "snowsql_exec" "snowflake_storage_integration" { } locals { - storage_integration_user_arn = local.terraform_resource_provider == "snowflake" ? snowflake_storage_integration.this[0].storage_aws_iam_user_arn : [for map in jsondecode(nonsensitive(snowsql_exec.snowflake_storage_integration[0].read_results)): map if map.property == "STORAGE_AWS_IAM_USER_ARN"][0]["property_value"] + storage_integration_user_arn = local.terraform_resource_provider == "snowflake" ? snowflake_storage_integration.this[0].storage_aws_iam_user_arn : [for map in jsondecode(nonsensitive(snowsql_exec.snowflake_storage_integration[0].read_results)) : map if map.property == "STORAGE_AWS_IAM_USER_ARN"][0]["property_value"] - storage_integration_external_id = local.terraform_resource_provider == "snowflake" ? snowflake_storage_integration.this[0].storage_aws_external_id : [for map in jsondecode(nonsensitive(snowsql_exec.snowflake_storage_integration[0].read_results)): map if map.property == "STORAGE_AWS_EXTERNAL_ID"][0]["property_value"] + storage_integration_external_id = local.terraform_resource_provider == "snowflake" ? snowflake_storage_integration.this[0].storage_aws_external_id : [for map in jsondecode(nonsensitive(snowsql_exec.snowflake_storage_integration[0].read_results)) : map if map.property == "STORAGE_AWS_EXTERNAL_ID"][0]["property_value"] } resource "snowflake_integration_grant" "this" {