terraform-provider-snowflake: [Bug]: grant_ownership does not work on procedure

Terraform CLI Version

1.8.3

Terraform Provider Version

0.89.0

Terraform Configuration

resource "snowflake_database" "test" {
  name = "DB"
}

resource "snowflake_schema" "test" {
  name     = "SCHEMA"
  database = snowflake_database.test.name
}

resource "snowflake_role" "test" {
  name = "TEST"
}

resource "snowflake_grant_account_role" "test" {
  role_name = snowflake_role.test.name
  parent_role_name = "SYSADMIN"
}

resource "snowflake_procedure" "test" {
  name        = "PROCEDURE"
  database    = snowflake_database.test.name
  schema      = snowflake_schema.test.name
  language    = "JAVASCRIPT"
  return_type = "VARCHAR"
  statement   = "return 'Hi'"
}

resource "snowflake_grant_ownership" "test" {
  account_role_name   = snowflake_role.test.name
  on {
    object_type = "PROCEDURE"
    object_name = "${snowflake_database.test.name}.${snowflake_schema.test.name}.${snowflake_procedure.test.name}()"
  }
}

Category

category:identifiers

Object type(s)

resource:grant_ownership

Expected Behavior

expected fully qualified name is "DB"."SCHEMA"."PROCEDURE"()

Actual Behavior

but actual is "DB"."SCHEMA"."PROCEDURE()"

โ”‚ Id: ToAccountRole|"TEST"||OnObject|PROCEDURE|"DB"."SCHEMA"."PROCEDURE()"
โ”‚ Error: 090208 (42601): Argument types of function 'PROCEDURE()' must be specified.

Steps to Reproduce

  1. copy the following configuration
  2. terraform apply

How much impact is this issue causing?

Medium

Logs

No response

Additional Information

The workaround for grant_privileges_to_account_role does not work because of the different parse logic of IDs.

Even if parse logic is the same, it does not work in a empty arguments because the () is removed. The following error should occur

Error: 090208 (42601): Argument types of function 'SOME_PROCEDURE' must be specified.

Would you like to implement a fix?

  • Yeah, Iโ€™ll take it ๐Ÿ˜Ž

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 15 (4 by maintainers)

Most upvoted comments

Hi @YAhiru @susanneauxmoney @rahulgoyal01 ๐Ÿ‘‹ The fix was released in a new provider version (v0.95.0). Please upgrade using the migration guide.

Hey @YAhiru, Iโ€™m back ๐Ÿ˜Ž and Iโ€™ll be working on identifiers this week, but the identifiers for functions/procedures can only be done after some other work that will be a base for other identifier improvements. That being said this issue should be resolved in this or next week (Iโ€™ll notify you here when it will be waiting for the release).

@sfc-gh-jmichalak Thank you!

In my environment, I was able to migrate without any problems!

Hey @YAhiru. @sfc-gh-jcieslak is on a short vacation. He will come back on Monday and the identifiers rework will be his first focus. I will let him know about your request, so he can provide you with a better timeline.

Hey ๐Ÿ‘‹ Thanks for creating an issue for this. The identifiers rework will happen this quarter, but we havenโ€™t started it yet. We have to analyze all the cases where we feel the identifiers are lacking and provide a proposal we can all agree on. Without the proposal, we cannot give any instructions, but I will link this issue to do it as part of the identifiers rework.