Snowflake Provider Error: could not retrieve session id err = object does not exist or not authorized

We have recently started getting errors when trying to run the snowflake-terraform provider locally.

Here is the full error:

│ Error: could not retrieve session id err = object does not exist or not authorized
│
│   with provider["registry.terraform.io/snowflake-labs/snowflake"].security_admin,
│   on provider.tf line 5, in provider "snowflake":
│    5: provider "snowflake" {
│
╵
╷
│ Error: could not retrieve session id err = object does not exist or not authorized
│
│   with provider["registry.terraform.io/snowflake-labs/snowflake"].user_admin,
│   on provider.tf line 15, in provider "snowflake":
│   15: provider "snowflake" {

It would seem to be an issue around the roles not having access to something, except for the fact that it runs without issue in the gitlab pipeline. We source control the .terraform.lock.hcl file so the environment should be the same.

Here is the full provider.tf file:

provider "snowflake" {
  role = "ACCOUNTADMIN"
}

provider "snowflake" {
  alias = "security_admin"
  role  = "SECURITYADMIN"
}

provider "snowflake" {
  alias = "sys_admin"
  role  = "SYSADMIN"
}

provider "snowflake" {
  alias = "user_admin"
  role  = "USERADMIN"
}
1 Like

I’m running into this same issue. This is my first time trying to use the snowflake provider. I’ve noticed that it works with the accountadmin and sysadmin roles, but even changing the default role for the user to securityadmin or useradmin throws the same error.

Were you able to find a solution?