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

(aws-ecs): Give Cluster a grant method for the task protection API #26233

Closed
1 of 2 tasks
SamStephens opened this issue Jul 5, 2023 · 2 comments · Fixed by #28486
Closed
1 of 2 tasks

(aws-ecs): Give Cluster a grant method for the task protection API #26233

SamStephens opened this issue Jul 5, 2023 · 2 comments · Fixed by #28486
Labels
@aws-cdk/aws-ecs Related to Amazon Elastic Container effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p2

Comments

@SamStephens
Copy link
Contributor

Describe the feature

In order for ECS tasks to interact with the task protection API, the task role needs permissions on the API.

It would be nice if ECS Cluster used the standard grantX pattern and provided a method similar to grantTaskProtection.

Use Case

To simplify declaring my tasks need permissions on the task protection API.

Proposed Solution

Currently my setup for the permissions is:

        cluster_task_arn = Stack.of(self).format_arn(
            service='ecs',
            resource='task',
            resource_name=f'{fargate_cluster.cluster_name}/*'
        )
        fargate_task_definition.add_to_task_role_policy(
            aws_iam.PolicyStatement(
                actions=["ecs:UpdateTaskProtection"],
                resources=[cluster_task_arn],
            )
        )

With this feature I'd expect to do something like

fargate_cluster.grant_task_protection(fargate_task_definition.task_role)

Other Information

See also my request for an arnForTasks method

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

CDK version used

2.85.0

Environment details (OS name and version, etc.)

Ubuntu (Windows Subsystem for Linux)

@SamStephens SamStephens added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Jul 5, 2023
@github-actions github-actions bot added the @aws-cdk/aws-ecs Related to Amazon Elastic Container label Jul 5, 2023
@pahud
Copy link
Contributor

pahud commented Jul 5, 2023

Sounds great and thank you for your PR.

@pahud pahud added p2 effort/small Small work item – less than a day of effort and removed needs-triage This issue or PR still needs to be triaged. labels Jul 5, 2023
@mergify mergify bot closed this as completed in #28486 Dec 27, 2023
mergify bot pushed a commit that referenced this issue Dec 27, 2023
… IAM entities (#28486)

Added a `grantTaskProtection` method to the ECS (Elastic Container Service) Cluster. This method grants ECS tasks the necessary permissions to interact with the task protection API.

Closes #26233

----

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

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

paulhcsun pushed a commit to paulhcsun/aws-cdk that referenced this issue Jan 5, 2024
… IAM entities (aws#28486)

Added a `grantTaskProtection` method to the ECS (Elastic Container Service) Cluster. This method grants ECS tasks the necessary permissions to interact with the task protection API.

Closes aws#26233

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-ecs Related to Amazon Elastic Container effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p2
Projects
None yet
2 participants