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(dynamodb): fix hardcoded partition in replica-provider IAM policy #25428

Merged
merged 1 commit into from
May 4, 2023

Conversation

jacklin213
Copy link
Member

This PR replaces the hardcoded aws partition used in the IAM policy with ${Aws:Partition} to ensure the correct partition is used during policy generation.

Closes #25407


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 May 4, 2023

@aws-cdk-automation aws-cdk-automation requested a review from a team May 4, 2023 03:51
@github-actions github-actions bot added beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK bug This issue is a bug. effort/small Small work item – less than a day of effort p1 labels May 4, 2023
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.

A comment requesting an exemption should contain the text Exemption Request. Additionally, if clarification is needed add Clarification Request to a comment.

@jacklin213 jacklin213 changed the title fix(dynamodb): Fix hardcoded partition in replica-provider IAM policy fix(dynamodb): fix hardcoded partition in replica-provider IAM policy May 4, 2023
@jacklin213
Copy link
Member Author

jacklin213 commented May 4, 2023

Clarification Request:
Currently there is 2 existing integ tests that cover the changes:

  • packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.global.js
  • packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.global-replicas-provisioned.js

No changes need to be made on the test but the snapshot needs to be updated.
When following https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md#creating-a-test to run the commands to update the snapshot
yarn integ --directory test/aws-dynamodb/test --update-on-failed
or directly on a test
yarn integ test/aws-dynamodb/test/integ.global-replicas-provisioned.js --update-on-failed

the tests will fail with CloudFormation throwing an error around the Custom Resource (code was not changed)

cdk-dynamodb-global-20191121 | 5:16:52 AM | CREATE_FAILED        | Custom::DynamoDBReplica    | Table/Replicaeu-west-2/Default (TableReplicaeuwest290D3CD3A) Received response status [FAILED] from custom resource. Message returned: index.onEventHandler is undefined or not exported

Logs: /aws/lambda/cdk-dynamodb-global-2019112-OnEventHandler42BEBAE0-vtrVfhgolHn0

    at Object.module.exports.load (/var/runtime/UserFunction.js:304:11)
    at Object.<anonymous> (/var/runtime/index.js:43:34)
    at Module._compile (internal/modules/cjs/loader.js:1114:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1143:10)
    at Module.load (internal/modules/cjs/loader.js:979:32)
    at Function.Module._load (internal/modules/cjs/loader.js:819:12)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:75:12)
    at internal/main/run_main_module.js:17:47 (RequestId: eb86698b-ff91-4a28-ace1-cf790210b531)

Looking for guidance on how to update the snapshots. Am I missing some other setup steps?

@aws-cdk-automation aws-cdk-automation added the pr/reviewer-clarification-requested The contributor has requested clarification on feedback, a failing build, or a failing PR Linter run label May 4, 2023
@aws-cdk-automation aws-cdk-automation dismissed their stale review May 4, 2023 13:58

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

@corymhall
Copy link
Contributor

Looking for guidance on how to update the snapshots. Am I missing some other setup steps?

Can you try running it with the --disable-update-workflow? My hunch is that something in the existing snapshot is breaking the deployment and this flag will just deploy the new app.

@jacklin213
Copy link
Member Author

jacklin213 commented May 4, 2023

@corymhall I figured it out. You were right about something in the existing snapshot breaking.
I had to nuke the previous global ddb related integ test snapshots, update the old integ tests to use the new IntegTests construct and then the integ tests successfully deployed as expected (CFN passed happily, didn't see any weird custom resource issues). My latest force push includes the integ test changes

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

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

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

@mergify
Copy link
Contributor

mergify bot commented May 4, 2023

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 mergify bot merged commit b5b4f66 into aws:main May 4, 2023
7 checks passed
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 bug This issue is a bug. effort/small Small work item – less than a day of effort p1 pr/reviewer-clarification-requested The contributor has requested clarification on feedback, a failing build, or a failing PR Linter run
Projects
None yet
Development

Successfully merging this pull request may close these issues.

(aws-dynamodb): replica-provider has a hardcoded aws partition in the IAM policy
3 participants