-
Notifications
You must be signed in to change notification settings - Fork 427
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_table_column_masking_policy_application keeps getting recreated at every plan #2236
Comments
Hey @patcky. Thanks for reporting the issue. We are currently migrating the table resource to the new SDK implementation; we will revisit this problem after this migration happens (maybe it will be enough to solve the issue). |
Hi @sfc-gh-asawicki actually this issue also happens on both network_policy and snowflake_account_password_policy_attachment modules with the current latest v0.92.
|
Hey @yinxu0619. Thanks for reaching out to us. The problem you described is not directly connected with either of these issues. It's connected with how the identifiers are handled inside the provider. We are currently working on them as part of https://github.com/Snowflake-Labs/terraform-provider-snowflake/blob/main/ROADMAP.md#our-roadmap. Also, we are currently redesigning the network policy resource in (#2914). I will make sure the issue you've mentioned is covered. cc: @sfc-gh-jcieslak |
Hey @yinxu0619 👋 Hey @patcky 👋 |
Hi SFC folks,
That plan was generated immediately after I had applied a similar plan - no changes to my TF code. If it would be useful, I can provide more details and / or open a new issue. |
This is caused by the legacy parsing of masking policy identifiers in this resource. We'll address this during table rework, which should happen soon. As a workaround, please use |
I have a workaround for re-creating the plan, i use the jsonnet to render the terraform and add a converter in the head like below:
by this, it can append double quotes to the {database}.{schema} automatically. |
Still hitting this in V1: |
Terraform CLI and Provider Versions
Terraform version: 1.2
Provider version: was initially using 0.67.0 but also tested with the most recent version (0.77.0 atm) to see if the bug was fixed, but it remained the same.
Terraform Configuration
Expected Behavior
When applying the masking policies to the column in the tables, they should only be created once. Using the lifecycle argument should prevent terraform from changing it again in the table level (not in the resource itself, though).
Actual Behavior
After creating and applying the policies for the first time, they show up in the plan as if changed, although nothing was changed. If
terraform apply
is executed, the issue persists and it keeps pointing the snowflake_table_column_masking_policy_application as if something changed:Steps to Reproduce
terraform plan
terraform apply
terraform plan
againHow much impact is this issue causing?
High
Logs
https://gist.github.com/patcky/4324cc01455c6ff817deeccc2e73590b
Additional Information
After some investigation and debugging, I found that the issue seems to be with the way the provider compares the snowflake_table_column_masking_policy_application returned by snowflake with the value saved in the state file.
The issue could be in this line, particularly in the function
ParseFullyQualifiedObjectID
, instrings.ReplaceAll(s, "\"", "")
command. Currently, as it is, the command removes the double quotes but not the escape characters \ which could be the cause of the issue, but it requires further investigation.I am attaching the relevant logs for debugging purposes.
The text was updated successfully, but these errors were encountered: