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]: Provider crashes when creating a view with a masking policy #3219

Closed
1 task
algrice opened this issue Nov 22, 2024 · 5 comments
Closed
1 task

[Bug]: Provider crashes when creating a view with a masking policy #3219

algrice opened this issue Nov 22, 2024 · 5 comments
Assignees
Labels
bug Used to mark issues with provider's incorrect behavior

Comments

@algrice
Copy link

algrice commented Nov 22, 2024

Terraform CLI Version

1.9.3

Terraform Provider Version

0.96.0

Company Name

No response

Terraform Configuration

resource "snowflake_view" "reproduce_error" {
  database        = "EXAMPLE_DATABASE"
  schema          = "EXAMPLE_SCHEMA"
  name            = upper("test_view")
  is_secure       = false
  change_tracking = false
  is_temporary    = false

  column {
    column_name = "id"
  }

  column {
    column_name = "version"
  }

  column {
    column_name = "data_source"
    masking_policy {
      policy_name = snowflake_masking_policy.test_policy.fully_qualified_name
      using       = ["data_source"]
    }
  }

  statement = <<-EOF
SELECT id, version, data_source
FROM "EXAMPLE_DATABASE"."EXAMPLE_SCHEMA"."EXAMPLETABLE";
EOF
}

Category

category:resource

Object type(s)

resource:view

Expected Behavior

I expected the view to get created successfully and have the masking policy applied to the column with no errors.

Actual Behavior

The view did get created successfully in Snowflake, but the terraform provider crashed immediately afterwards.

Steps to Reproduce

Copy the terraform from above after replacing the database / schema / query and policy reference with real resources. Run terraform apply.

How much impact is this issue causing?

Medium

Logs

https://gist.github.com/algrice/da65a8bd4f5ce5bc120609c006650241

Additional Information

No response

Would you like to implement a fix?

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

Hi @algrice 👋

We've released fixes for view resource in v0.97 (release, migration guide). Please upgrade to this version. I've verified this now, and in v097 a similar setup works correctly. If not, please let us know. In this case, please provide more logs before the crash, with TF_LOG=DEBUG.

@sfc-gh-jmichalak sfc-gh-jmichalak self-assigned this Nov 22, 2024
@algrice
Copy link
Author

algrice commented Nov 22, 2024

We've released fixes for view resource in v0.97 (release, migration guide). Please upgrade to this version. I've verified this now, and in v097 a similar setup works correctly. If not, please let us know. In this case, please provide more logs before the crash, with TF_LOG=DEBUG.

Hi! Thanks for the suggestion. Unfortunately we haven't been able to test anything greater than v0.96 because we're blocked on this issue #3136

We can continue working around by creating views with a snowflake_unsafe_execute resource unless you have a better work around?

@sfc-gh-jcieslak
Copy link
Collaborator

Hey @algrice
If that helps, #3136 will be fixed (along with many other task issues) in the provider's next (v0.99.0) version.

@algrice
Copy link
Author

algrice commented Nov 27, 2024

Hi! We've been able to upgrade to v0.99 and can confirm we can now create views with masking policies using the snowflake_view resource. 😃

One minor bug we're seeing on v0.99: if we don't pass a using on the masking_policy then we see the provider crash again despite that field being documented as optional. https://registry.terraform.io/providers/Snowflake-Labs/snowflake/latest/docs/resources/view#using-1

That's not at all a blocker for us though. Thanks!

@algrice algrice closed this as completed Nov 27, 2024
@sfc-gh-jmichalak
Copy link
Collaborator

Hi @algrice 👋

We've just released v0.100.0 (release, migration guide) with the fix. Please upgrade to this version and let us know if you have any issues, preferably in a new issue.

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
Projects
None yet
Development

No branches or pull requests

3 participants