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

[Bug]: Failed to describe stage on terraform plan #3265

Closed
1 task
AJuanJim opened this issue Dec 10, 2024 · 4 comments
Closed
1 task

[Bug]: Failed to describe stage on terraform plan #3265

AJuanJim opened this issue Dec 10, 2024 · 4 comments
Labels
bug Used to mark issues with provider's incorrect behavior

Comments

@AJuanJim
Copy link

Terraform CLI Version

1.5.0

Terraform Provider Version

0.85.0

Company Name

No response

Terraform Configuration

Hello, 

We tried to execute a terraform plan without making any changes on our configuration files and we found the following error on our stages:

Error: Failed to describe stage
with module.sfbs.snowflake_stage.stage["DB.PUBLIC.STAGE"], on ../modules/snowflake_bs/db-objects.tf line 174, in resource "snowflake_stage" "stage": 174: resource "snowflake_stage" "stage" {
Id: , Err: [errors.go:17] object does not exist or not authorized

Our stages are being created with an AccountAdmin privilege following the next configuration:

resource "snowflake_stage" "stage" {
  for_each = local.stage_map
 
  database            = snowflake_database.db[each.value.db].name
  schema              = each.value.schema == "PUBLIC" ? "PUBLIC" : snowflake_schema.schema[each.value.schema_id].name
  name                = each.value.stage
  url                 = each.value.url
  storage_integration = each.value.storage_integration

  lifecycle {
    ignore_changes = [directory]
  }
}

Also we found out that our last successful was executed on 04/12/2024(dd/mm/yyyy) having snowflake on version 8.44.2 and today when we are having above mentioned errors, we have the version 8.45.1, could this version upgrade cause problems with our terraform config?

Category

category:resource

Object type(s)

No response

Expected Behavior

0 changes on terraform plan

Actual Behavior

Error: Failed to describe stage
with module.sfbs.snowflake_stage.stage["DB.PUBLIC.STAGE"], on ../modules/snowflake_bs/db-objects.tf line 174, in resource "snowflake_stage" "stage": 174: resource "snowflake_stage" "stage" {
Id: , Err: [errors.go:17] object does not exist or not authorized

Steps to Reproduce

Run terraform plan

How much impact is this issue causing?

High

Logs

No response

Additional Information

No response

Would you like to implement a fix?

  • Yeah, I'll take it 😎
@AJuanJim AJuanJim added the bug Used to mark issues with provider's incorrect behavior label Dec 10, 2024
@AJuanJim
Copy link
Author

AJuanJim commented Dec 11, 2024

Hi,

After further investigation of the issue, we found the following error on all our stages:

"DB"."PUBLIC"."STAGE" err 002003 (02000): SQL compilation error:
2024-12-11T08:07:26.148+0100 [DEBUG] provider.terraform-provider-snowflake_v0.85.0: 2024/12/11 08:07:26 [DEBUG] sql-conn-query: [query DESCRIBE STAGE

But when we are looking on the query history of the user with which these queries are being executed we found the following error:

image

image

But when we run this same describes or queries from the Snowflake UI, we can run it without finding any errors.

@AJuanJim
Copy link
Author

Hi,

We executed again a terraform plan isolating one of the stages, finding this errors after debugging:

2024-12-11T10:30:57.033+0100 [DEBUG] provider.terraform-provider-snowflake_v0.85.0: time="2024-12-11T10:30:57+01:00" level=error msg="error: 002003 (02000): SQL compilation error:\nDatabase 'DB' does not exist or not authorized." func="gosnowflake.(*snowflakeConn).queryContextInternal" file="connection.go:396"

2024-12-11T10:30:57.033+0100 [DEBUG] provider.terraform-provider-snowflake_v0.85.0: 2024/12/11 10:30:57 [DEBUG] sql-conn-query: [query DESCRIBE STAGE "DB"."PUBLIC"."STAGE" err 002003 (02000): SQL compilation error:

@AJuanJim
Copy link
Author

Hi,

Finally with the help of Snowflake Support we could fix the issue, which was provoked due to a change on the default role of the user who was running the queries on terraform, after modifying that everything works properly.

Thank you for your help and sorry for the inconvenience.

@sfc-gh-jcieslak
Copy link
Collaborator

Hey @AJuanJim
Sorry for the late response. I'm happy that you managed to quickly fix your issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Used to mark issues with provider's incorrect behavior
Projects
None yet
Development

No branches or pull requests

2 participants