CloudFormation updates may fail to delete resources

Aperta
#2,800 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
38/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
aws, github-actions, python
Ambito
cloud, devops

Direzione di ricerca

Inspect the GitHub Actions deploy workflow and the CloudFormation logs mentioned for the 2025-03-11 deployment. Start by tracing how the workflow reports stack update results, including child stacks. Done means deployments fail when a stack reports orphaned resources in its StatusReason, with coverage for the reported child stack behavior.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Jira Bug

Jira: https://asfdaac.atlassian.net/browse/TOOL-3771

Note: The above link is accessible only to members of ASF.


When deploying HyP3 to update an existing CloudFormation stack, it's possible that CloudFormation may attempt and fail to delete a resource, which results in the resource being removed from the stack but not deleted. From the "Resource removed from stack but not deleted" section of the CloudFormation troubleshooting guide:

During a stack update, CloudFormation has removed a resource from a stack but not deleted the resource. The resource still exists, but is no longer accessible through CloudFormation. This may occur during stack updates where:

  • CloudFormation needs to replace an existing resource, so it first creates a new resource, then attempts to delete the old resource.
  • You have removed the resource from the stack template, so CloudFormation attempts to delete the resource from the stack.

However, there may be cases where CloudFormation can't delete the resource. For example, if the user doesn't have permissions to delete a resource of a given type.

CloudFormation attempts to delete the old resource three times. If CloudFormation can't delete the old resource, it removes the old resource from the stack and continues updating the stack. When the stack update is complete, CloudFormation issues an UPDATE_COMPLETE stack event, but includes a StatusReason that states that one or more resources couldn't be deleted. CloudFormation also issues a DELETE_FAILED event for the specific resource, with a corresponding StatusReason providing more detail on why CloudFormation failed to delete the resource.

To resolve this situation, delete the resource directly using the console or API for the underlying service.

We ran into an issue when deploying HyP3 v9.5.4, which removed the start_execution_worker and start_execution_manager Lambda functions and replaced them with a single start_execution Lambda. However, the JPL service users lacked the cloudformation:DeleteStack permission and were therefore unable to delete the StartExecutionWorker and StartExecutionManager stacks, which resulted in those stacks being removed from the parent stack but not deleted. This caused jobs to fail unexpectedly because the manager was still pulling jobs and submitting them to the worker.

The important part from the above docs is:

If CloudFormation can't delete the old resource, it removes the old resource from the stack and continues updating the stack. When the stack update is complete, CloudFormation issues an UPDATE_COMPLETE stack event, but includes a StatusReason that states that one or more resources couldn't be deleted.

We didn't notice the issue when updating the stack because the update succeeded with UPDATE_COMPLETE, but we should be able to check the StatusReason and have our GitHub Actions deploy workflow fail if there are orphaned resources (or any other error messages in StatusReason?). For orphaned resources, the StatusReason is: Update successful. One or more resources could not be deleted.

Although, from the CloudFormation logs for the 2025-03-11 deployment, it looks like the StatusReason only appears for the StepFunction stack (which was the parent of the StartExecutionWorker and StartExecutionManager stacks), not for the top-level hyp3 stack. So, it could be tricky to detect orphaned resources in child stacks.

Also see:

Lingua principale
Python
Stelle
53
Fork
13
Merge medio
1g 2h
PR unite (30g)
20

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di ASFHyP3/hyp3

Tutte le issue di ASFHyP3/hyp3

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.