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]: Terraform import snowflake_function Error: object does not exist #3094

Open
1 task
mike-soukup-vividseats opened this issue Sep 19, 2024 · 5 comments
Open
1 task
Labels
bug Used to mark issues with provider's incorrect behavior

Comments

@mike-soukup-vividseats
Copy link

Terraform CLI Version

1.5.7

Terraform Provider Version

0.95.0

Terraform Configuration

When I follow the docs https://registry.terraform.io/providers/Snowflake-Labs/snowflake/0.95.0/docs/resources/function#import
to import a snowflake_function resource, I get an error after the Import was prepared that the object does not exist. This doesn't help resolve the issue in anyway and I am stuck. 

resource "snowflake_function" "flatten_ga_params" {
  name     = "flatten_ga_params"
  provider = snowflake.sys_admin
  database = "LANDING"
  schema   = "GA"
  arguments {
    name = "E"
    type = "VARIANT"
  }
  comment     = "Function to flatten GA4 event params"
  return_type = "VARIANT"
  language    = "javascript"
  statement   = "function code here"
}

Import statement: terraform import snowflake_function.flatten_ga_params 'LANDING.GA.flatten_ga_params(variant)'

Category

category:import

Object type(s)

No response

Expected Behavior

I expect this resource to be imported into the statefile.

Actual Behavior

Import is prepared but Error: object does not exist is returned

Steps to Reproduce

Copy the configuration and run the import provided.

How much impact is this issue causing?

Medium

Logs

No response

Additional Information

No response

Would you like to implement a fix?

  • Yeah, I'll take it 😎
@mike-soukup-vividseats mike-soukup-vividseats added the bug Used to mark issues with provider's incorrect behavior label Sep 19, 2024
@sfc-gh-jmichalak
Copy link
Collaborator

sfc-gh-jmichalak commented Sep 20, 2024

Hi @mike-soukup-vividseats 👋

I can't reproduce this issue. Could you share logs with TF_LOG=DEBUG? Also, can you confirm in Snowsight that DESCRIBE FUNCTION "LANDING"."GA"."flatten_ga_params"(VARIANT) returns the function you want to import?

@mike-soukup-vividseats
Copy link
Author

Hi @sfc-gh-jmichalak I can confirm that the function does exist in Snowflake. I validated the id from an old statefile to be this:
""LANDING"."GA"."flatten_ga_params"(VARIANT)"

But even this throws the same error when I try to import it. Due to some sensitive info, I do not wish to share the debug logs.

Can you give more context where this error message would come from? Can you validate the terraform import syntax is correct?
image
image

@sfc-gh-jmichalak
Copy link
Collaborator

I think that the name in Snowflake is upper case, but you try importing with lower case (flatten_ga_params). Please try importing with upper case. In Terraform case is sensitive.

@mike-soukup-vividseats
Copy link
Author

Well, I was skeptical, but that worked!

terraform import 'snowflake_function.flatten_ga_params' ""LANDING"."GA"."FLATTEN_GA_PARAMS"(VARIANT)"

Capitalizing the function name led to a successful import!

@sfc-gh-jmichalak
Copy link
Collaborator

Cool, can we close this issue, then?

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