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 of snowflake_tag_masking_policy_association is not working correctly #3148

Open
1 task
saugandhik-kipi opened this issue Oct 22, 2024 · 4 comments
Assignees
Labels
bug Used to mark issues with provider's incorrect behavior resource:tag_masking_policy_association Issue connected to the snowflake_tag_masking_policy_association resource

Comments

@saugandhik-kipi
Copy link

Terraform CLI Version

1.9.8

Terraform Provider Version

0.97.0

Terraform Configuration

While trying to import an existing terraform resource of snowflake_tag_masking_policy_association
using the below statement -
terraform import snowflake_tag_masking_policy_association.example 'ANALYTICS_PRODUCTION_DB.SNAPSHOTS.ON_CHURN_ARCHIVE'

as per the documentation.
https://registry.terraform.io/providers/Snowflake-Labs/snowflake/latest/docs/resources/tag_masking_policy_association 
# format is tag database name | tag schema name | tag name | masking policy database | masking policy schema | masking policy name
terraform import module.tag.snowflake_tag_masking_policy_association.KIPI_ANALYSIS_DATA_MASKING_privacy_category_custom_PHI_REDACTED_MASK "KIPI_ANALYSIS|DATA_MASKING|PRIVACY_CATEGORY_CUSTOM|RAW_PRODUCTION_DB|PG_LOG_PUBLIC|PHI_REDACTED_MASK"


But while looking at the terraform state file I am not able to understand why everything is blank.
So this import statement is not able to import the resource correctly. 
Please help me on this.

Category

category:resource

Object type(s)

No response

Expected Behavior

tag_id = snowflake_tag.this.fully_qualified_name
masking_policy_id = snowflake_masking_policy.example_masking_policy.fully_qualified_name

Actual Behavior

{
"address":"module.tag.snowflake_tag_masking_policy_association.KIPI_ANALYSIS_DATA_MASKING_privacy_category_custom_PHI_REDACTED_MASK",
"mode":"managed",
"type":"snowflake_tag_masking_policy_association",
"name":"KIPI_ANALYSIS_DATA_MASKING_privacy_category_custom_PHI_REDACTED_MASK",
"provider_name":"registry.terraform.io/snowflake-labs/snowflake",
"schema_version":0,
"values":{
"id":"KIPI_ANALYSIS|DATA_MASKING|PRIVACY_CATEGORY_CUSTOM|RAW_PRODUCTION_DB|PG_LOG_PUBLIC|PHI_REDACTED_MASK",
"masking_policy_id":null,
"tag_id":null
},
"sensitive_values":{

                 }
              }

Steps to Reproduce

Import any snowflake_tag_masking_policy_association association in terraform state.

How much impact is this issue causing?

High

Logs

No response

Additional Information

image

Would you like to implement a fix?

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

Hi @saugandhik-kipi 👋

This resource will be deprecated in one of the releases - please use snowflake_tag_association like this:

resource "snowflake_tag_association" "example" {
  object_identifier {
    name     = snowflake_masking_policy.example_masking_policy.name
    database = snowflake_masking_policy.example_masking_policy.database
    schema   = snowflake_masking_policy.example_masking_policy.schema
  }
  object_type = "MASKING POLICY"
  tag_id      = snowflake_tag.this.fully_qualified_name
  tag_value   = "<tag_value>"
}

you can import it with
terraform import snowflake_tag_association.example 'KIPI_ANALYSIS.DATA_MASKING.PRIVACY_CATEGORY_CUSTOM'

If this still doesn't work, please provide logs with TF_LOG=DEBUG.
Note that snowflake_tag_association will also be reworked soon.

@saugandhik-kipi
Copy link
Author

Hi @sfc-gh-jmichalak ,
Having similar issue with snowflake_tag_association.
Created a bug #3145

@sfc-gh-jmichalak
Copy link
Collaborator

Sorry, I didn't connect these two. As it was mentioned in the comment there, I'll handle this during tag rework, but still, snowflake_tag_masking_policy_association will probably be deprecated.

@sfc-gh-jmichalak sfc-gh-jmichalak self-assigned this Oct 23, 2024
@sfc-gh-jmichalak sfc-gh-jmichalak added the resource:tag_masking_policy_association Issue connected to the snowflake_tag_masking_policy_association resource label Oct 23, 2024
@sfc-gh-jmichalak
Copy link
Collaborator

Hi @saugandhik-kipi 👋

We've just released v0.100.0 (release, migration guide) in which we concluded rework of tags and tag associations. Please use masking_policies in the tag resource instead. For managing tags on objects, use the tag_association resource. Please upgrade to this version and let us know if you have any issues.

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 resource:tag_masking_policy_association Issue connected to the snowflake_tag_masking_policy_association resource
Projects
None yet
Development

No branches or pull requests

2 participants