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

Project: return success after removing ID #1308

Merged
merged 1 commit into from
Jan 17, 2025

Conversation

lionello
Copy link
Contributor

@lionello lionello commented Jan 17, 2025

When a project is gone from DO, a refresh fails because the project cannot be found. The code detects the 404 but still returns an error, so the refresh fails, instead of saving the updated state.

Here's a log (from Pulumi):

[2025-01-17 03:01:35]  ~  digitalocean:index:Project project refreshing (0s) error:   sdk-v2/provider2.go:457: sdk.helper_schema: Error reading Project: GET https://api.digitalocean.com/v2/projects/7242f1c8-65fb-46bd-93e2-63b263ddd15e: 404 (request "f81512c7-d34c-4c04-ab6b-aedbad9cead9") project not found: [email protected]

After erasing the resource ID, the code falls through to the error, instead of returning nil (which is also the behavior of many other resources in the 404 case).

Copy link
Member

@andrewsomething andrewsomething left a comment

Choose a reason for hiding this comment

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

Great catch! Thanks @lionello! 🙏

@andrewsomething andrewsomething merged commit 593cff5 into digitalocean:main Jan 17, 2025
3 checks passed
@lionello lionello deleted the patch-1 branch January 17, 2025 15:31
@lionello
Copy link
Contributor Author

@andrewsomething Thanks!

By the way, there might be more like these. Here's another one:

@kumavis
Copy link

kumavis commented Jan 27, 2025

requesting release that includes this fix

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