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: Add support for default_secondary_roles #1030

Merged
merged 7 commits into from
Jun 16, 2022

Conversation

mwiewior
Copy link
Contributor

@mwiewior mwiewior commented May 30, 2022

This to implement feature request #773
This feature is especially important if you use OAuth2 authentication mechanism with BI tool like Looker due to the
following limitation of this integration:

When using OAuth, you cannot switch to different roles in the Snowflake user account. As described in the Snowflake documentation, Snowflake uses the default role of the Snowflake user’s account, unless the default role is ACCOUNTADMIN or SECURITYADMIN. Because these roles are blocked for OAuth, Snowflake will instead use the PUBLIC role. See the Snowflake documentation for information.

Test Plan

  • acceptance tests

References

@mwiewior mwiewior marked this pull request as ready for review June 2, 2022 10:46
@mwiewior mwiewior changed the title Adding support for default_secondary_roles feat:Adding support for default_secondary_roles Jun 3, 2022
@mwiewior mwiewior changed the title feat:Adding support for default_secondary_roles feat: Adding support for default_secondary_roles Jun 3, 2022
@mwiewior mwiewior changed the title feat: Adding support for default_secondary_roles feat: Add support for default_secondary_roles Jun 3, 2022
@mwiewior
Copy link
Contributor Author

mwiewior commented Jun 9, 2022

@sfc-gh-swinkler may I ask for activating GH actions for this PR pls?

@sfc-gh-swinkler
Copy link
Collaborator

hello @mwiewior can you please rebase?

@mwiewior
Copy link
Contributor Author

hello @sfc-gh-swinkler done !

@mwiewior
Copy link
Contributor Author

@sfc-gh-swinkler I've just spotted that some acceptance tests failed - will take a look and fix them.

Copy link
Collaborator

@sfc-gh-swinkler sfc-gh-swinkler left a comment

Choose a reason for hiding this comment

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

looks good, but if you could please provide some clarification that would be nice

@@ -200,6 +207,11 @@ func ReadUser(d *schema.ResourceData, meta interface{}) error {
return err
}

err = d.Set("default_secondary_roles", removeEmptyStrings(strings.Split(u.DefaultSecondaryRoles.String, ",")))
Copy link
Collaborator

Choose a reason for hiding this comment

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

unclear why there would be an empty string here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@sfc-gh-swinkler ok, I refactored this one as well to make it more clear.

pkg/snowflake/user.go Show resolved Hide resolved
@sfc-gh-swinkler
Copy link
Collaborator

also can you please rebase?

@mwiewior
Copy link
Contributor Author

@sfc-gh-swinkler rebased as well

@mwiewior
Copy link
Contributor Author

Acceptance tests passed.

@mwiewior
Copy link
Contributor Author

@sfc-gh-swinkler could you pls take a look?

@sfc-gh-swinkler
Copy link
Collaborator

/ok-to-test sha=283acef

1 similar comment
@sfc-gh-swinkler
Copy link
Collaborator

/ok-to-test sha=283acef

@github-actions
Copy link

Integration tests success for 283acef

@github-actions
Copy link

Integration tests success for 283acef

@sfc-gh-swinkler
Copy link
Collaborator

@mwiewior i am sorry but could you please rebase one more time? I just merged a different PR that that made this one out of date again. Everything else looks good to go for this PR though.

@mwiewior
Copy link
Contributor Author

@sfc-gh-swinkler thx ! I've just rebased.

@sfc-gh-swinkler
Copy link
Collaborator

/ok-to-test sha=5344760

@github-actions
Copy link

Integration tests success for 5344760

@sfc-gh-swinkler sfc-gh-swinkler merged commit ae8f3da into Snowflake-Labs:main Jun 16, 2022
@sfc-gh-swinkler
Copy link
Collaborator

@mwiewior thank you for your contribution!

@mwiewior
Copy link
Contributor Author

@sfc-gh-swinkler thx for your valuable comments and help in getting it through!

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.

2 participants