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(ecs): canContainersAccessInstanceRole is ignored when passed in AsgCapacityProvider constructor #20522

Merged
merged 8 commits into from
May 27, 2022

Conversation

daschaa
Copy link
Contributor

@daschaa daschaa commented May 27, 2022

Fixes #20293

When adding an AsgCapacityProvider the property canContainersAccessInstanceRole is only checked when passed in via the method addAsgCapacityProvider. It is ignored when passing the property via the instantiation of an AsgCapacityProvider. In this PR I added, that if either one way (method or constructor) has got the property set - it is respected in the outcome. For more details please see the issue #20293

I decided not to omit the property on the class level because it would bring in breaking changes.


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 May 27, 2022

@github-actions github-actions bot added bug This issue is a bug. effort/small Small work item – less than a day of effort p2 labels May 27, 2022
@aws-cdk-automation aws-cdk-automation requested a review from a team May 27, 2022 12:12
Copy link
Contributor

@corymhall corymhall left a comment

Choose a reason for hiding this comment

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

@daschaa thanks for the fix!

I'm wondering if it might also be good to throw an error if the user sets canContainersAccessInstanceRole on both and they are different values? Like you explicitly set it to true on one and false on the other, are you sure?

packages/@aws-cdk/aws-ecs/lib/cluster.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-ecs/lib/cluster.ts Outdated Show resolved Hide resolved
@daschaa
Copy link
Contributor Author

daschaa commented May 27, 2022

@corymhall Thanks for the hint! I didn't thought about that case.
An error is a good idea. But this could maybe lead to breaking changes.

Another approach/idea is, that addAsgCapacityProvider could take precedence over the constructor one. If added explicitly to the method, the property is then "overridden".
What do you think?

Co-authored-by: Cory Hall <43035978+corymhall@users.noreply.github.com>
@mergify mergify bot dismissed corymhall’s stale review May 27, 2022 14:06

Pull request has been modified.

@corymhall
Copy link
Contributor

@corymhall Thanks for the hint! I didn't thought about that case. An error is a good idea. But this could maybe lead to breaking changes.

Another approach/idea is, that addAsgCapacityProvider could take precedence over the constructor one. If added explicitly to the method, the property is then "overridden". What do you think?

yeah that's a good call. addAsgCapacityProvider should take precedence to keep backwards compatibility 👍

@daschaa
Copy link
Contributor Author

daschaa commented May 27, 2022

@corymhall Cool! I will add a test for that.

@daschaa
Copy link
Contributor Author

daschaa commented May 27, 2022

@corymhall I have now added test cases for the precedence. Could you review it again please?
Thanks for your feedback and help! ❤️

@mergify
Copy link
Contributor

mergify bot commented May 27, 2022

Thank you for contributing! Your pull request will be updated from master 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: AutoBuildProject89A8053A-LhjRyN9kxr8o
  • Commit ID: 8787f2a
  • 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 dacefd6 into aws:master May 27, 2022
@mergify
Copy link
Contributor

mergify bot commented May 27, 2022

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

@joeflateau
Copy link
Contributor

Thank you @daschaa!

@daschaa
Copy link
Contributor Author

daschaa commented May 27, 2022

@joeflateau Thank you for creating the issue! Your finding was 99% of the work ❤️

@daschaa daschaa deleted the ecs-can-access-container-instance-role branch May 27, 2022 19:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. effort/small Small work item – less than a day of effort p2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

aws-ecs: canContainersAccessInstanceRole option is ignored
4 participants