Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(opensearch): log group policies ignore incorrect error code on delete #22364

Merged

Conversation

LarsFronius
Copy link
Contributor

@LarsFronius LarsFronius commented Oct 5, 2022

Updates ignore error code to reflect actual error code and gracefully handle the case when a log group policy is being deleted but already does not exist, because the cluster was shut down previously.

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:XXXXX:stack/XXXXX/06651720-40b5-11ed-887d-0a422088f326",
    "RequestId": "90891990-91c1-43bf-82e3-0d98832fc82c",
    "LogicalResourceId": "OpenSearchDomainESLogGroupPolicyc83ee46895a093e947614fc60b86c1a65d36a02321E1EA3F89",
    "NoEcho": false,
    "Data": {}
}

All Submissions:

Adding new Unconventional Dependencies:

  • This PR adds new unconventional dependencies following the process described here

New Features

  • Have you added the new feature to an integration test?
    • Did you use yarn integ to deploy the infrastructure and generate the snapshot (i.e. yarn integ without --dry-run)?

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@gitpod-io
Copy link

gitpod-io bot commented Oct 5, 2022

@github-actions github-actions bot added beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK p2 labels Oct 5, 2022
@aws-cdk-automation aws-cdk-automation requested a review from a team October 5, 2022 09:56
Copy link
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.

@LarsFronius LarsFronius force-pushed the opensearch-log-group-resource-policy-delete branch from c225bad to bdb5497 Compare October 5, 2022 10:03
@aws-cdk-automation
Copy link
Collaborator

This PR has been in the CHANGES REQUESTED state for 3 weeks, and looks abandoned. To keep this PR from being closed, please continue work on it. If not, it will automatically be closed in a week.

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": {}
}
@LarsFronius LarsFronius force-pushed the opensearch-log-group-resource-policy-delete branch from 58ff417 to f0d64f9 Compare October 31, 2022 16:34
@TheRealAmazonKendra TheRealAmazonKendra added the pr-linter/cli-integ-tested Assert that any CLI changes have been integ tested label Oct 31, 2022
@TheRealAmazonKendra
Copy link
Contributor

Adding an integ test exemption because the change is reflected in snapshots.

@TheRealAmazonKendra TheRealAmazonKendra changed the title fix(opensearch): Fixes delete behaviour for opensearch and elasticsearch log group policies. fix(opensearch): log group policies ignore incorrect error code on delete Oct 31, 2022
@TheRealAmazonKendra TheRealAmazonKendra added pr-linter/exempt-integ-test The PR linter will not require integ test changes and removed pr-linter/cli-integ-tested Assert that any CLI changes have been integ tested labels Oct 31, 2022
@TheRealAmazonKendra
Copy link
Contributor

Oops. Wrong label.

@aws-cdk-automation aws-cdk-automation dismissed their stale review October 31, 2022 19:25

✅ Updated pull request passes all PRLinter validations. Dissmissing previous PRLinter review.

@mergify
Copy link
Contributor

mergify bot commented Oct 31, 2022

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify
Copy link
Contributor

mergify bot commented Oct 31, 2022

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: b9326eb
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify mergify bot merged commit ebba9e3 into aws:main Oct 31, 2022
@mergify
Copy link
Contributor

mergify bot commented Oct 31, 2022

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK p2 pr-linter/exempt-integ-test The PR linter will not require integ test changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants