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: Create a snowflake_user_grant resource. #1193

Merged
merged 3 commits into from
Sep 20, 2022

Conversation

hleb-lizunkou1
Copy link
Contributor

@hleb-lizunkou1 hleb-lizunkou1 commented Aug 28, 2022

Create a snowflake_user_grant resource.

Test Plan

  • acceptance tests
  • unit tests
  • tested in my snowflake account

References

(Feature Request) Create resource snowflake_user_grant

@@ -0,0 +1,2 @@
# format is user name | | | privilege | true/false for with_grant_option
terraform import snowflake_user_grant.example 'userName|||MONITOR|true'
Copy link
Collaborator

Choose a reason for hiding this comment

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

what is with the weird id format? why have ||| instead of |?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually this format is used everywhere, i'm just trying to follow codebase format

# format is integration name ||| privilege | true/false for with_grant_option
terraform import snowflake_integration_grant.example 'intName|||USAGE|true'

# format is account name | | | privilege | true/false for with_grant_option
terraform import snowflake_account_grant.example 'accountName|||USAGE|true'

if err != nil {
return err
}
err = d.Set("with_grant_option", grantID.GrantOption)
Copy link
Collaborator

Choose a reason for hiding this comment

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

is it possible to read the role to determine if with_grant_option has been set already? it would be nice if this could actually be read, rather than just set from the id. i know we don't do that anywhere else, i am just wondering.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

propably yes, i beleive it's better to make in separte PR for it to have the same approach for all grants resources

@sfc-gh-swinkler sfc-gh-swinkler changed the title Create a snowflake_user_grant resource. feat: Create a snowflake_user_grant resource. Sep 16, 2022
@sfc-gh-swinkler
Copy link
Collaborator

/ok-to-test sha=1b03a11

@github-actions
Copy link

Integration tests failure for 1b03a11

@sfc-gh-swinkler
Copy link
Collaborator

sfc-gh-swinkler commented Sep 16, 2022

Hello @hleb-lizunkou1 . Getting the following error message when running integration tests:

     Error: 003008 (42601): SQL compilation error:
        Invalid object type 'USER' for privilege 'USAGE'.
        
          on terraform_plugin_test.tf line 11, in resource "snowflake_user_grant" "test":
          11: resource "snowflake_user_grant" "test" {

--- FAIL: TestAcc_UserGrant (3.87s)

@hleb-lizunkou1
Copy link
Contributor Author

@sfc-gh-swinkler i have updated PR with fix please take a look at last commit

@sfc-gh-swinkler
Copy link
Collaborator

/ok-to-test sha=a6d207e

@github-actions
Copy link

Integration tests failure for a6d207e

@sfc-gh-swinkler
Copy link
Collaborator

hi @hleb-lizunkou1 can you please run make docs? also it looks like integration tests failed with the following error message:

=== CONT  TestAcc_UserGrant
    user_grant_acceptance_test.go:20: Step 1/2 error: Check failed: Check 2/2 error: snowflake_user_grant.test: Attribute 'privilege' expected "MONITORING", got "MONITOR"

@hleb-lizunkou1
Copy link
Contributor Author

hi @sfc-gh-swinkler i have run make docs and fixed integration tests

@sfc-gh-swinkler
Copy link
Collaborator

/ok-to-test sha=0dede64

@github-actions
Copy link

Integration tests success for 0dede64

@sfc-gh-swinkler
Copy link
Collaborator

@Hleb-Lizunkou thank you for your contribution!

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.

None yet

3 participants