Skip to content

Commit

Permalink
Updates ignore error code to reflect actual error code and gracefully
Browse files Browse the repository at this point in the history
handle the case when a log group policy is being deleted but already
does not exist, because the cluster was shut down already.

Observed behaviour:
ResourceNotFoundException: Policy with name [ESLogPolicyc83ee46895a093e947614fc60b86c1a65d36a02321] does not exist.
    at Request.extractError (/tmp/node_modules/aws-sdk/lib/protocol/json.js:52:27)
    at Request.callListeners (/tmp/node_modules/aws-sdk/lib/sequential_executor.js:106:20)
    at Request.emit (/tmp/node_modules/aws-sdk/lib/sequential_executor.js:78:10)
    at Request.emit (/tmp/node_modules/aws-sdk/lib/request.js:686:14)
    at Request.transition (/tmp/node_modules/aws-sdk/lib/request.js:22:10)
    at AcceptorStateMachine.runTo (/tmp/node_modules/aws-sdk/lib/state_machine.js:14:12)
    at /tmp/node_modules/aws-sdk/lib/state_machine.js:26:10
    at Request.<anonymous> (/tmp/node_modules/aws-sdk/lib/request.js:38:9)
    at Request.<anonymous> (/tmp/node_modules/aws-sdk/lib/request.js:688:12)
    at Request.callListeners (/tmp/node_modules/aws-sdk/lib/sequential_executor.js:116:18) {
  code: 'ResourceNotFoundException',
  time: 2022-10-04T16:28:57.966Z,
  requestId: '719a967b-bfea-435a-9aeb-ca8b67888e47',
  statusCode: 400,
  retryable: false,
  retryDelay: 38.982884472906434
}

Responding
{
    "Status": "FAILED",
    "Reason": "Policy with name [ESLogPolicyc83ee46895a093e947614fc60b86c1a65d36a02321] does not exist.",
    "PhysicalResourceId": "2022/10/04/[$LATEST]b282f3f11b1142c0afe77f0d62523288",
    "StackId": "arn:aws:cloudformation:eu-central-1:165893140444:stack/ReviewShippingEngineStage-review-feature-dcp-481-test-ShippingEngineSearchStack/06651720-40b5-11ed-887d-0a422088f326",
    "RequestId": "90891990-91c1-43bf-82e3-0d98832fc82c",
    "LogicalResourceId": "OpenSearchDomainESLogGroupPolicyc83ee46895a093e947614fc60b86c1a65d36a02321E1EA3F89",
    "NoEcho": false,
    "Data": {}
}
  • Loading branch information
LarsFronius committed Oct 5, 2022
1 parent e9dd1ab commit bdb5497
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Expand Up @@ -42,7 +42,7 @@ export class LogGroupResourcePolicy extends cr.AwsCustomResource {
parameters: {
policyName: props.policyName,
},
ignoreErrorCodesMatching: '400',
ignoreErrorCodesMatching: 'ResourceNotFoundException',
},
policy: cr.AwsCustomResourcePolicy.fromSdkCalls({ resources: ['*'] }),
});
Expand Down
Expand Up @@ -42,7 +42,7 @@ export class LogGroupResourcePolicy extends cr.AwsCustomResource {
parameters: {
policyName: props.policyName,
},
ignoreErrorCodesMatching: '400',
ignoreErrorCodesMatching: 'ResourceNotFoundException',
},
policy: cr.AwsCustomResourcePolicy.fromSdkCalls({ resources: ['*'] }),
});
Expand Down

0 comments on commit bdb5497

Please sign in to comment.