aws / aws-cdk

The AWS Cloud Development Kit is a framework for defining cloud infrastructure in code
https://aws.amazon.com/cdk
Apache License 2.0
11.55k stars 3.87k forks source link

fix(ecs): reduce ecs service task role cloudwatch permissions when no log configured (under feature flag) #31475

Closed GavinZZ closed 1 week ago

GavinZZ commented 1 week ago

Issue # (if applicable)

Closes https://github.com/aws/aws-cdk/issues/31397

Reason for this change

If a FargateService or EC2 Service has enableExecuteCommand: true and the ECS cluster it runs on has executeCommandConfiguration.logging set to anything but ecs.ExecuteCommandLogging.NONE then the CDK automatically grants the underlying TaskDefinition overly broad cloudwatch logs permissions regardless of need even if the logging configuration has no cloudwatch logs config set.

This is not right behaviour as these permissions are not needed.

Description of changes

Add feature flag and if feature flag is on and cloudwatch log is configured, reduce the permissions.

Description of how you validated changes

New unit tests, integration tests.

Checklist


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

mergify[bot] commented 1 week ago

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 commented 1 week ago

AWS CodeBuild CI Report

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

mergify[bot] commented 1 week ago

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).

github-actions[bot] commented 1 week ago

Comments on closed issues and PRs are hard for our team to see. If you need help, please open a new issue that references this one.