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]: snowflake_grant_privileges_to_share results in permadiff when granting to external tables #3167

Open
1 task
maxnsdia opened this issue Oct 31, 2024 · 1 comment
Labels
feature-request Used to mark issues with provider's missing functionalities

Comments

@maxnsdia
Copy link

maxnsdia commented Oct 31, 2024

Terraform CLI Version

1.9.8

Terraform Provider Version

0.97

Terraform Configuration

Using the resource snowflake_grant_privileges_to_share results in a permadiff when granting for external tables.
https://registry.terraform.io/providers/Snowflake-Labs/snowflake/latest/docs/resources/
Would we need the parameter "on_external_table"? I'm using "on_table" now for external tables, but it seems when refreshing the state, it results in a permadiff, it wants to add the grants again.
The apply does succeed and I can see the grant is given.

resource "snowflake_grant_privileges_to_share" "table" {
  to_share     = "myshare"
  privileges   = ["SELECT"]
  on_table     = "db.schema.externaltablename"
}

Category

category:grants

Object type(s)

resource:grant_privileges_to_share

Expected Behavior

I expect new grants for external tables on a share to be planned and applied once.

Actual Behavior

The grants keep being planned, resulting in a permadiff.

Steps to Reproduce

  • Create a new share and external table or use existing
  • Use the terraform resource "snowflake_grant_privileges_to_share" with the on_table property and make sure to use one or more external tables there. Grant SELECT.
  • Run a terraform plan and apply
  • Rerun it, it should be planned again.

How much impact is this issue causing?

Low

Logs

No response

Additional Information

No response

Would you like to implement a fix?

  • Yeah, I'll take it 😎
@maxnsdia maxnsdia added the bug Used to mark issues with provider's incorrect behavior label Oct 31, 2024
@sfc-gh-jcieslak
Copy link
Collaborator

Hey @maxnsdia 👋
I'm guessing that in this case there may be an object type mismatch in SHOW GRANTS, probably "EXTERNAL TABLE" is returned when we expect "TABLE". Other table types are something new and they have to be added for this resource to work with them. Marking this as a future request. For now, the only workaround is to use unsafe_execute until fields for other types will be there.

@sfc-gh-jcieslak sfc-gh-jcieslak added feature-request Used to mark issues with provider's missing functionalities and removed bug Used to mark issues with provider's incorrect behavior labels Nov 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Used to mark issues with provider's missing functionalities
Projects
None yet
Development

No branches or pull requests

2 participants