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

snowflake_procedure is not idempotent #2146

Open
jrobison-sb opened this issue Oct 23, 2023 · 1 comment
Open

snowflake_procedure is not idempotent #2146

jrobison-sb opened this issue Oct 23, 2023 · 1 comment
Labels
bug Used to mark issues with provider's incorrect behavior category:resource resource:procedure Issue connected to the snowflake_procedure resource

Comments

@jrobison-sb
Copy link
Contributor

Provider Version

$ terraform version
Terraform v1.6.1
on darwin_arm64
+ provider registry.terraform.io/snowflake-labs/snowflake v0.73.0

Terraform Version

$ terraform version
Terraform v1.6.1
on darwin_arm64
+ provider registry.terraform.io/snowflake-labs/snowflake v0.73.0

Describe the bug

snowflake_procedure's are not idempotent.

Expected behavior

snowflake_procedure's are idempotent.

Code samples and commands

  1. Create a procedure resource like this one and do terraform apply:
resource "snowflake_procedure" "dev2837" {
  name     = "DEV2837"
  language = "JAVASCRIPT"
  database = snowflake_database.default.name
  schema   = snowflake_schema.share_config[0].name
  arguments {
    name = "VIEWNAME"
    type = "VARCHAR"
  }
  return_type = "VARCHAR"
  execute_as  = "OWNER"
  statement   = <<EOT
    const dbName = '${snowflake_database.default.name}';
EOT
}
  1. Go to the Snowflake console and drop the procedure, out-of-band from Terraform:
DROP PROCEDURE DEV2837(VARCHAR);
  1. Run terraform apply again. Terraform should detect that the procedure no longer exists and it should offer to recreate the procedure for you. But instead, Terraform just errors out:
│ Error: 002003 (02000): SQL compilation error:
│ Procedure 'MY_DB.MY_SCHEMA.DEV2837' does not exist or not authorized.
│ 
│   with module.sandbox4_application.snowflake_procedure.dev2837,
│   on ../../modules/aws/application/snowflake.tf line 1411, in resource "snowflake_procedure" "dev2837":
│ 1411: resource "snowflake_procedure" "dev2837" {

Additional context

The behavior noticed here is essentially the same thing as described for snowflake_schema's here: #845, though I don't know if both are caused by the same code paths or not.

@jrobison-sb jrobison-sb added the bug Used to mark issues with provider's incorrect behavior label Oct 23, 2023
@sfc-gh-jcieslak sfc-gh-jcieslak added category:resource resource:procedure Issue connected to the snowflake_procedure resource labels May 20, 2024
@sfc-gh-asawicki
Copy link
Collaborator

Hey @jrobison-sb.

In v0.100.0, we introduced new procedure resources. They have this behavior fixed. Please verify it and let us know.

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 category:resource resource:procedure Issue connected to the snowflake_procedure resource
Projects
None yet
Development

No branches or pull requests

3 participants