aws-cloudformation / aws-cloudformation-resource-providers-stepfunctions

The CloudFormation Resource Provider Package For AWS Step Functions
https://aws.amazon.com/step-functions/
Apache License 2.0
6 stars 4 forks source link

Add stabilization to Activity Delete handler #51

Closed hongkuntian closed 7 months ago

hongkuntian commented 8 months ago

Issue #, if available: N/A

Description of changes:

Add stabilization to AWS::StepFunctions::Activity resource's Delete handler

Motivation:

DescribeActivity operation is eventually consistent. The results are best effort and may not reflect very recent updates and changes. This results in the Read handler not always retrieving the correct state after the deletion of an activity. (e.g. Invoke Delete handler, and the immediately invoking Read handler may return the activity details despite the activity having been deleted)

This change follows CloudFormation's best practices in how to develop resource handlers:

DO NOT delegate the response of the model, check existence, or stabilization in CREATE, UPDATE and DELETE handler to the READ handler

This change adds the following logic to stabilize the deletion:

The above logic is made possible by setting variables in the CallbackContext, so each invocation of the Delete handler (and callbacks) has context on whether the handler has already deleted the activity/which retry attempt we are on.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.