fix: Avoid error in organization delete operation if done just after creation#1542
Merged
AgustinBettati merged 7 commits intomasterfrom Jan 21, 2026
Merged
fix: Avoid error in organization delete operation if done just after creation#1542AgustinBettati merged 7 commits intomasterfrom
AgustinBettati merged 7 commits intomasterfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Implements a retry mechanism for organization deletion to handle transient HTTP 500 errors that occur when deleting an organization immediately after creation.
Changes:
- Added retry logic with a 20-second wait before reattempting deletion on HTTP 500 errors
- Refactored delete logic into a separate
runDeletefunction to enable reuse for retry attempts - Added auto-generated type configuration file
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| cfn-resources/organization/cmd/resource/resource.go | Refactored delete operation to support retry on HTTP 500 errors by extracting core deletion logic into runDelete function |
| cfn-resources/organization/cmd/resource/config.go | Auto-generated type configuration boilerplate |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
lantoli
approved these changes
Jan 21, 2026
manupedrozo
approved these changes
Jan 21, 2026
| if responseMsg.Error != nil { | ||
| // Retry once on transient server error, waiting 20 seconds before retrying request | ||
| // This covers case of contract tests which create and delete an org within seconds, encountering an error while deleting the org | ||
| if responseMsg.Response != nil && responseMsg.Response.StatusCode == http.StatusInternalServerError { |
Collaborator
There was a problem hiding this comment.
May want to add a log here
oarbusi
approved these changes
Jan 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed changes
Jira ticket: CLOUDP-332705
Context
Our CI contract tests of organization resource have been failing consistently (reference), specifically in
contract_create_delete, where a DELETEHTTP 500 Internal Server Erroris encountered.Upstream team confirmed this error is expected if delete is called just after creation, and advise waiting some seconds after creation before trying the delete. There is no intention on changing the error message either.
Solution
To unblock contract tests (which create and delete instantly), and cover this potential use case for any customer, as per triage we agreed to add a retry request if initial request fails.
CI contract tests are now passing, and also verified the organization creation/deletion creating a stack with a private publish:

Type of change:
expected)
Manual QA performed:
Required Checklist:
make fmtand formatted my codeworks in Atlas
Further comments