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

fix: function not exist and integration grant #1154

Merged

Conversation

israel
Copy link
Contributor

@israel israel commented Jul 24, 2022

Added generic resource not found error
Fixed 'function' not exist scenario
Fixed grant helpers to consider only relevant grants

Fixed 'function' not exist scenario
Fixed grant helpers to consider only relevant grants
Fixed 'function' not exist scenario
Fixed grant helpers to consider only relevant grants
Fixed 'stage' not exist scenario
@israel israel force-pushed the israel/fixing_more_resources branch from 3718433 to a95879d Compare August 2, 2022 08:42
@sfc-gh-swinkler
Copy link
Collaborator

@israel i understand that you escalated this with Snowflake support. i would like to help you get this merged. if you could please address the two comments from my review i would be happy to merge with for you

@sfc-gh-swinkler
Copy link
Collaborator

@israel if you are busy, would you like me to make the changes for you?

@israel
Copy link
Contributor Author

israel commented Sep 4, 2022

@israel if you are busy, would you like me to make the changes for you?

@sfc-gh-swinkler, Sorry about the delay, was on vacation and just came back.
I cannot seem to find your review/comments.
Thanks

log.Printf("[DEBUG] integration_name: %v", d.Get("integration_name"))
log.Printf("[DEBUG] privilege: %v", d.Get("privilege"))
log.Printf("[DEBUG] with_grant_option: %v", d.Get("with_grant_option"))
log.Printf("[DEBUG] enable_multiple_grants: %v", d.Get("enable_multiple_grants"))
Copy link
Collaborator

Choose a reason for hiding this comment

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

these debug logs should be removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed

}

// If no relevant grants, set id to blank and return (see HACK HACK comment above)
if len(relevantGrants) == 0 {
Copy link
Collaborator

Choose a reason for hiding this comment

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

can you check error code rather than use a hack?

Copy link
Contributor Author

@israel israel Sep 11, 2022

Choose a reason for hiding this comment

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

I thought that returning empty ID is the hack. (from the comment above that mentions the HACK). Regardless, I think that the check is OK. There is no error code in this case. A grant (or grants were) was found but non relevant to our search since they do not match the privilege or grant option properties.

@sfc-gh-swinkler
Copy link
Collaborator

@israel can you see now?

Fixed 'function' not exist scenario
Fixed grant helpers to consider only relevant grants
Fixed 'stage' not exist scenario
removed unnecessary debug logs
@sfc-gh-swinkler
Copy link
Collaborator

/ok-to-test sha=412e14b

@github-actions
Copy link

Integration tests failure for 412e14b

@sfc-gh-swinkler
Copy link
Collaborator

can you please rebase to master? tests are failing for a weird reason

@israel
Copy link
Contributor Author

israel commented Sep 13, 2022

can you please rebase to master? tests are failing for a weird reason

I have rebased before last push. Test is failing and I think that the test might be wrong, however, not sure. Why is it expected that the result is empty here:


if we created a non empty stage resource here:
d := stage(t, "test_db|test_schema|test_stage", in)

?

@sfc-gh-swinkler
Copy link
Collaborator

#1220 i have a fix for this here. once this gets merged we can retry your integration tests

@sfc-gh-swinkler
Copy link
Collaborator

/ok-to-test sha=ee833bb

@sfc-gh-swinkler
Copy link
Collaborator

@israel thank you for your contribution. sorry it took so long to get this merged.

@sfc-gh-swinkler sfc-gh-swinkler merged commit ea01e66 into Snowflake-Labs:main Sep 20, 2022
@github-actions
Copy link

Integration tests success for ee833bb

@israel
Copy link
Contributor Author

israel commented Sep 21, 2022

Thanks !!

@sfc-gh-swinkler
Copy link
Collaborator

sfc-gh-swinkler commented Sep 22, 2022

@israel i need to revert the changes that were made the to grant_helpers.go file. users have reported problems with inconsistent plan results. I believe when they are trying to do an update the relevant grants may return empty when in fact it should not. if you could please explain the exact problem you were trying to solve, i may be able to work on an alternative fix that would avoid this inconsistent plan problem. My PR to revert the change is here: #1236

@scottwinkler
Copy link
Contributor

https://github.com/Snowflake-Labs/terraform-provider-snowflake/pull/1229/files this was a draft PR someone else did to fix the problem, but not sure if needed or not. if these is needed i suppose we can make a follow up PR

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