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?

질문됨 3년 전698회 조회
1개 답변
0
수락된 답변

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
전문가
Raphael
답변함 3년 전
AWS
전문가
검토됨 2년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠