Skip to content

Switch SNOWFLAKE_ROLE for resource creation using VCS in Terraform Cloud #1650

Closed Answered by tamathew
tamathew asked this question in Q&A
Discussion options

You must be logged in to vote

I solved the problem by not declaring the SNOWFLAKE_ROLE as my environment or TF variable. Instead , I used used provider config in every single terraform file with an alias . The provider config would switch the role .

eg :
filename : roles.tf

provider "snowflake" {

role = "USERADMIN"
alias = "useradmin"

}

resource "snowflake_role" "role" {
provider = snowflake.useradmin
name = "DEVELOPER_ROLE"
comment = "Developer role for Service accounts"
}

filename : databases.tf

provider "snowflake" {

role = "SYSADMIN"
alias = "sysadmin"

}

resource "snowflake_database" "database" {
provider = snowflake.sysadmin
name = "SALES_DB"
comment = "Sales database"
}

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@culpgrant
Comment options

Answer selected by tamathew
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants