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: handling not exist gracefully #1031

Merged
merged 11 commits into from
Jun 16, 2022

Conversation

israel
Copy link
Contributor

@israel israel commented May 30, 2022

This is my first PR here so I have made changes to only some of the resources. Once approved I will do the same for the rest. Thanks

Changed handling of not exists scenarios for read resource functions for User, API Integration and External Function resources

Test Plan

Updated user_test to reflect the change.

References

@sfc-gh-swinkler
Copy link
Collaborator

Hello @israel, thank you for your PR!

I think this is good, just I would ask for you to create a new file called errors.go at pkg/snowflake/errors.go to declare this error as a constant. For example, take a look at how this provider did the same thing you are doing:
https://github.com/hashicorp/terraform-provider-tfe/blob/main/tfe/resource_tfe_team.go#L155-L162

and then they declared that error in the errors.go file:
https://github.com/hashicorp/go-tfe/blob/main/errors.go#L13

This is not something we are currently doing, but its a pattern I would like to start abiding by. If you could please do this I would be much obliged.

@israel
Copy link
Contributor Author

israel commented Jun 7, 2022

Hi @sfc-gh-swinkler
Apologies for the delayed response, I have not seen the notification for some reason...
I have moved the generic error from external_function.go to a common errors file as you requested.
Thanks,
Israel

@israel israel changed the title handling not exist gracefully fix: handling not exist gracefully Jun 8, 2022
pkg/resources/api_integration.go Outdated Show resolved Hide resolved
@sfc-gh-swinkler
Copy link
Collaborator

/ok-to-test sha=7a8f66b

@github-actions
Copy link

Integration tests success for 7a8f66b

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

Thank you for your contribution! @israel

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