Skip to content

Commit 135bfe7

Browse files
fix: CFn CustomResources shouldn't change PhysicalResourceId in Delete requests
1 parent 95b6a9f commit 135bfe7

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

cfn/wrap.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"context"
77
"encoding/json"
88
"errors"
9+
"fmt"
910
"log"
1011
"net/http"
1112

@@ -58,6 +59,10 @@ func lambdaWrapWithClient(lambdaFunction CustomResourceFunction, client httpClie
5859
r.Status = StatusFailed
5960
r.Reason = err.Error()
6061
log.Printf("sending status failed: %s", r.Reason)
62+
} else if event.RequestType == RequestDelete && event.PhysicalResourceID != r.PhysicalResourceID {
63+
r.Status = StatusFailed
64+
r.Reason = fmt.Sprintf("DELETE: cannot change the physical resource ID from %s to %s during deletion", event.PhysicalResourceID, r.PhysicalResourceID)
65+
log.Printf("sending status failed: %s", r.Reason)
6166
} else {
6267
r.Status = StatusSuccess
6368
}

0 commit comments

Comments
 (0)