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

feat: Masking policy data source v1 #3083

Merged
merged 17 commits into from
Sep 18, 2024
Merged

Conversation

sfc-gh-jmichalak
Copy link
Collaborator

  • adjust filtering options
  • move output to *_output fields
  • extract common code for easier reuse
  • link new issue to one of the resources

Test Plan

  • acceptance tests

References

https://docs.snowflake.com/en/sql-reference/sql/show-masking-policies

pkg/datasources/common.go Show resolved Hide resolved
pkg/datasources/masking_policies.go Outdated Show resolved Hide resolved
docs/data-sources/masking_policies.md Show resolved Hide resolved
Copy link

Integration tests failure for c7a55b261d7bb7efb20c34ecb3c8cfd8b551755e

Copy link

Integration tests failure for 24cc353c80dd618c74d0461ff1fac3133bc8dfea

Copy link

Integration tests failure for 2c89f3afa1e60494f9f905229c46ca40fffc0468

Copy link

Integration tests failure for b5cd8ed276004dcea6c9d56de5722b1b9c9a27be

Base automatically changed from masking-policy-v1 to main September 18, 2024 10:58
Copy link

Integration tests failure for 0f97452ccee2fb712f0d70beea671f9f0a8deb2f

Copy link

Integration tests failure for 8a7e621f15c8c203c715752bb7aa3743ec27dabd

Copy link

Integration tests failure for b0a7b2b4c33e4e2941f5cdf68ea8efb48d3534e9

@sfc-gh-jmichalak sfc-gh-jmichalak merged commit 2553fbf into main Sep 18, 2024
8 of 9 checks passed
@sfc-gh-jmichalak sfc-gh-jmichalak deleted the masking-policy-ds-v1 branch September 18, 2024 14:58
sfc-gh-fbudzynski pushed a commit that referenced this pull request Sep 19, 2024
<!-- Feel free to delete comments as you fill this in -->
- adjust filtering options
- move output to `*_output` fields
- extract common code for easier reuse
- link new issue to one of the resources
<!-- summary of changes -->

## Test Plan
<!-- detail ways in which this PR has been tested or needs to be tested
-->
* [x] acceptance tests
<!-- add more below if you think they are relevant -->

## References
<!-- issues documentation links, etc  -->
https://docs.snowflake.com/en/sql-reference/sql/show-masking-policies
sfc-gh-jmichalak pushed a commit that referenced this pull request Sep 19, 2024
🤖 I have created a release *beep* *boop*
---


##
[0.96.0](v0.95.0...v0.96.0)
(2024-09-18)

Essential GA object readiness for V1:
[link](https://github.com/Snowflake-Labs/terraform-provider-snowflake/blob/main/v1-preparations/ESSENTIAL_GA_OBJECTS.MD)
([Roadmap
reference](https://github.com/Snowflake-Labs/terraform-provider-snowflake/blob/main/ROADMAP.md#preparing-essential-ga-objects-for-the-provider-v1)).

:exclamation: Migration guide: [v0.95.0 ->
v0.96.0](https://github.com/Snowflake-Labs/terraform-provider-snowflake/blob/main/MIGRATION_GUIDE.md#v0950--v0960)

### 🎉 **What's new:**

* V1 redesign of resources and data sources
* Row access policy
([#3066](#3066))
([#3063](#3063))
* Resource monitor
([#3052](#3052))
([#3064](#3064))
* Masking policy
([#3078](#3078))
([#3083](#3083))
* SDK upgrades
* External volume
([#3033](#3033))
* Authentication policy
([#2937](#2937))
([#3068](#3068))
([#3061](#3061))


### 🔧 **Misc**

* Clean up old test object helpers
([#3049](#3049))
* Add example of granting role to multiple objects
([#3047](#3047))
* Update readme and objects rework state
([#3046](#3046))

### 🐛 **Bug fixes:**

* Fix model grants
([#3070](#3070))
* Fix database show by and resource logic
([#3055](#3055))
* Fix default secondary roles option import
([#3041](#3041))
* Fix sweepers for warehouse and database
([#3057](#3057))
* Fix views permadiff
([#3079](#3079))
* Update v0.95.0 migration guide
([#3062](#3062))

Co-authored-by: snowflake-release-please[bot] <105954990+snowflake-release-please[bot]@users.noreply.github.com>
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)

func handleLike(d *schema.ResourceData, setField **sdk.Like) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice functions. I have two remarks though:

  1. Please add unit tests.
  2. They are a bit "optimistic" (e.g. l := v.([]any)[0].(map[string]any) in limit from) - please handle errors in all these funcs.

id := acc.TestClient().Ids.RandomSchemaObjectIdentifier()

body := "case when current_role() in ('ANALYST') then 'true' else 'false' end"
policyModel := model.MaskingPolicy("test", []sdk.TableColumnSignature{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: such model is repeated multiple times (here and in resource tests), maybe extracting DefaultMaskingPolicy(id) or something similar would be a good idea?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants