Skip to content

Conversation

isker
Copy link
Contributor

@isker isker commented Sep 26, 2025

Reason for this change

You can't remove placement strategies from an ECS service using CDK once they've been set.

Description of changes

Same fix as #30382 but for placementStrategies. Apparently this was not done at that time because CloudFormation previously did not have the appropriate semantics for setting PlacementStrategies to the empty array as it did for PlacementConstraints, but that is no longer the case. The CloudFormation docs state:

To remove this property from your service resource, specify an empty PlacementStrategy array.

Describe any new or updated permissions being added

N/A

Description of how you validated changes

Unit and integration tests.

Checklist


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

@github-actions github-actions bot added the p2 label Sep 26, 2025
@aws-cdk-automation aws-cdk-automation requested a review from a team September 26, 2025 01:28
@github-actions github-actions bot added the repeat-contributor [Pilot] contributed between 3-5 PRs to the CDK label Sep 26, 2025
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.

(This review is outdated)

@isker isker changed the title fix(aws-ecs): allow empty placementStrategies on EC2Service fix(ecs): allow empty placementStrategies on EC2Service Sep 26, 2025
@aws-cdk-automation aws-cdk-automation dismissed their stale review September 26, 2025 01:37

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

Same fix as aws#30382 but for `placementStrategies`. Apparently this was
not done at that time because CloudFormation [previously did not have
the appropriate
semantics](aws#27572 (comment))
for setting PlacementStrategies to the empty array as it did for
PlacementConstraints, but that is no longer the case. The CloudFormation
docs
[state](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-ecs-service.html#cfn-ecs-service-placementstrategies):
> To remove this property from your service resource, specify an empty PlacementStrategy array.

And indeed that works, with this CDK change applied.
@isker isker force-pushed the ecs-empty-placementstrategies branch from 415b28c to dcdd1f7 Compare September 26, 2025 03:18
@aws-cdk-automation aws-cdk-automation added the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Sep 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p2 pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. repeat-contributor [Pilot] contributed between 3-5 PRs to the CDK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants