Why does my stack deletion fail because of an error that occurs when deleting a custom resource?

0

My custom resource is configured as follows:

Resources:
    SecretTagValCreation:
      Type: Custom::SecretTagValCreation
      Properties:
        ServiceToken: arn:aws:lambda:us-east-2:ACCOUNT_NUMBER:function:ReturnSecretToCFNForEC2
        Region: !Ref "AWS::Region"
        Env: !Ref 'EnvTagValue'
        ProjID: !Ref 'ProjIDTagValue'
        Dept: !Ref 'DepTagValue'
        Owner: !Ref 'OwnerTagValue'
        StackID: !Ref 'AWS::StackId'
        StackName: !Ref 'AWS::StackName'

I have the AWS CloudFormation stack created in one account, and an AWS Lambda function created in a different account. My code works, and the Lambda function can be invoked by the CloudFormation role. However, I can't delete my stacks because the custom resource doesn't get deleted during stack creation. The status of the stack is "DELETE_FAILED" or "ROLLBACK_FAILED" (if there is an error with stack). If I retain the custom resource and try deleting the stack again, then the stack gets deleted. However, this is not ideal. How do I delete the resources properly?

gefragt vor 3 Jahren698 Aufrufe
1 Antwort
0
Akzeptierte Antwort

This issue occurs under one or more of the following conditions:

  • You don't send a response.
  • An issue occurs during your handler's cleanup.

Check if you've implemented the delete event in your Custom Resource (event['RequestType'] == 'Delete').

AWS
EXPERTE
Raphael
beantwortet vor 3 Jahren
AWS
EXPERTE
überprüft vor 2 Jahren

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen