Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolved #66. Resolved #67. #68

Merged
merged 1 commit into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions .terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ All notable changes to this project will be documented in this file.

The format is base on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.37.00.000] - 2024-11-22
### Added
- [Issue #66](https://github.com/j3-signalroom/iac-snowflake-resources-tf/issues/66)

### Changed
- [Issue #67](https://github.com/j3-signalroom/iac-snowflake-resources-tf/issues/67)

## [0.37.00.000] - 2024-11-22
### Changed
- Upgraded the version of Terraform AWS Provider to `5.77.0`, and Terraform Snowflake Provider to `0.98.0`.
Expand Down
2 changes: 1 addition & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ terraform {
}
snowflake = {
source = "Snowflake-Labs/snowflake"
version = "~> 0.98.0"
version = "~> 0.99.0"
}
}
}
Expand Down
19 changes: 13 additions & 6 deletions snowflake-securityadmin-resources.tf
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
provider "snowflake" {
alias = "security_admin"
role = "SECURITYADMIN"
account = jsondecode(data.aws_secretsmanager_secret_version.admin_public_keys.secret_string)["account"]
user = jsondecode(data.aws_secretsmanager_secret_version.admin_public_keys.secret_string)["admin_user"]
authenticator = "JWT"
private_key = jsondecode(data.aws_secretsmanager_secret_version.admin_public_keys.secret_string)["active_rsa_public_key_number"] == 1 ? data.aws_secretsmanager_secret_version.admin_private_key_1.secret_string : data.aws_secretsmanager_secret_version.admin_private_key_2.secret_string
alias = "security_admin"
role = "SECURITYADMIN"

# The most recently version of Snowflake Terraform Provider requires the
# `organization_name` and `account_name` to be set, whereas the previous
# versions did not require this. That is why we are setting these values
# here. Plus, `account` as been deprecated in favor of `account_name`.
organization_name = "${split("-", jsondecode(data.aws_secretsmanager_secret_version.admin_public_keys.secret_string)["account"])[0]}"
account_name = "${split("-", jsondecode(data.aws_secretsmanager_secret_version.admin_public_keys.secret_string)["account"])[1]}"

user = jsondecode(data.aws_secretsmanager_secret_version.admin_public_keys.secret_string)["admin_user"]
authenticator = "JWT"
private_key = jsondecode(data.aws_secretsmanager_secret_version.admin_public_keys.secret_string)["active_rsa_public_key_number"] == 1 ? data.aws_secretsmanager_secret_version.admin_private_key_1.secret_string : data.aws_secretsmanager_secret_version.admin_private_key_2.secret_string
}

resource "snowflake_account_role" "role" {
Expand Down
17 changes: 12 additions & 5 deletions snowflake-sysadmin-resources.tf
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
provider "snowflake" {
role = "SYSADMIN"
account = jsondecode(data.aws_secretsmanager_secret_version.admin_public_keys.secret_string)["account"]
user = jsondecode(data.aws_secretsmanager_secret_version.admin_public_keys.secret_string)["admin_user"]
authenticator = "JWT"
private_key = jsondecode(data.aws_secretsmanager_secret_version.admin_public_keys.secret_string)["active_rsa_public_key_number"] == 1 ? data.aws_secretsmanager_secret_version.admin_private_key_1.secret_string : data.aws_secretsmanager_secret_version.admin_private_key_2.secret_string
role = "SYSADMIN"

# The most recently version of Snowflake Terraform Provider requires the
# `organization_name` and `account_name` to be set, whereas the previous
# versions did not require this. That is why we are setting these values
# here. Plus, `account` as been deprecated in favor of `account_name`.
organization_name = "${split("-", jsondecode(data.aws_secretsmanager_secret_version.admin_public_keys.secret_string)["account"])[0]}"
account_name = "${split("-", jsondecode(data.aws_secretsmanager_secret_version.admin_public_keys.secret_string)["account"])[1]}"

user = jsondecode(data.aws_secretsmanager_secret_version.admin_public_keys.secret_string)["admin_user"]
authenticator = "JWT"
private_key = jsondecode(data.aws_secretsmanager_secret_version.admin_public_keys.secret_string)["active_rsa_public_key_number"] == 1 ? data.aws_secretsmanager_secret_version.admin_private_key_1.secret_string : data.aws_secretsmanager_secret_version.admin_private_key_2.secret_string
}

resource "snowflake_database" "example" {
Expand Down