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]: grant_privileges_to_share - on_function - An argument named "on_function" is not expected here. #3081

Closed
1 task
nx-rebecca opened this issue Sep 16, 2024 · 2 comments
Assignees
Labels
general-usage General help/usage questions

Comments

@nx-rebecca
Copy link

nx-rebecca commented Sep 16, 2024

Terraform CLI Version

1.8.3

Terraform Provider Version

0.93.0

Terraform Configuration

resource "snowflake_share" "share" {
  provider = snowflake.listing_manager
  name     = "SHARE"
}

resource "snowflake_grant_privileges_to_share" "db_grant" {
  provider    = snowflake.listing_manager
  to_share    = snowflake_share.share.name
  privileges  = ["USAGE"]
  on_database = snowflake_database.db.name
}

resource "snowflake_grant_privileges_to_share" "schema_grant" {
  depends_on = [snowflake_grant_privileges_to_share.db]
  provider   = snowflake.listing_manager
  to_share   = snowflake_share.share.name
  privileges = ["USAGE"]
  on_schema  = "${snowflake_database.db.name}.${snowflake_schema.schema.name}"
}

resource "snowflake_grant_privileges_to_share" "function_grant" {
  depends_on = [snowflake_grant_privileges_to_share.schema]
  provider = snowflake.listing_manager
  to_share = snowflake_share.share.name
  privileges = ["USAGE"]
  on_function = "${snowflake_database.db.name}.${snowflake_schema.schema.name}.${snowflake_function.function.name}(VARCHAR)"
}

Category

category:grants

Object type(s)

resource:grant_privileges_to_share

Expected Behavior

Usage on the function is granted to the share

Actual Behavior

Got this error:

│ Error: Unsupported argument

│ on ....\modules\pcsect\snowflake-shares.tf line 306, in resource "snowflake_grant_privileges_to_share" "function_grant":
│ 306: on_function = "${snowflake_database.db.name}.${snowflake_schema.schema.name}.${snowflake_function.function.name}(VARCHAR)"

│ An argument named "on_function" is not expected here.

Steps to Reproduce

Run terraform apply
(Requires the necessary db, schema and function to exist)

How much impact is this issue causing?

Medium

Logs

No response

Additional Information

According to provider docs (https://registry.terraform.io/providers/Snowflake-Labs/snowflake/latest/docs/resources/grant_privileges_to_share) on_function is a supported argument.

Would you like to implement a fix?

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

Hi @nx-rebecca 👋 This feature is supported in v0.95.0. Please migrate to this version, see the migration guide.

Also, objects can be referenced with the fully_qualified_name field, like
on_function = snowflake_function.function.fully_qualified_name

@sfc-gh-jmichalak sfc-gh-jmichalak added general-usage General help/usage questions and removed bug Used to mark issues with provider's incorrect behavior labels Sep 16, 2024
@nx-rebecca
Copy link
Author

Hi @sfc-gh-jmichalak
Thanks for the tip. That seems to have resolved the issue!

@sfc-gh-jmichalak sfc-gh-jmichalak self-assigned this Oct 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
general-usage General help/usage questions
Projects
None yet
Development

No branches or pull requests

2 participants