-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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_cdk.aws_ecs: empty placement constraints / placement strategies not allowed #27555
Comments
Before we look at the rest of the issue, I'd like to point out that values we lazily calculate cannot be modified with escape hatches, because that takes place after escape hatches go through. However, you can use escape hatches within aspects to modify those properties |
Ok, this issue makes sense. I'm not sure why |
Submitted Pull Request. |
#30382 is Good to be reviewed. |
…30382) ### Issue fixes #27555 Closes Half Fix [i.e, Allows user to give Empty Placement Constraints ] #27555 This PR does not address supporting empty placement strategies because of the following reason : [27555 : comment](#27572 (comment)) This was raised with the guidance from - [pr / 28431 : Comment ](#28431 (comment)) ### Reason for this change Users unable to give empty placementConstraints ### Description of how you validated changes - Added a UnitCase to cover with empty `[]` placementConstraints - Integration Tests ``` $ yarn integ test/aws-ecs/test/ec2/integ.placement-constraint-default-empty.js --update-on-failed ``` After integ tests were completed, `npm test` to verify the snapshot. ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
|
…aws#30382) ### Issue fixes aws#27555 Closes Half Fix [i.e, Allows user to give Empty Placement Constraints ] aws#27555 This PR does not address supporting empty placement strategies because of the following reason : [27555 : comment](aws#27572 (comment)) This was raised with the guidance from - [pr / 28431 : Comment ](aws#28431 (comment)) ### Reason for this change Users unable to give empty placementConstraints ### Description of how you validated changes - Added a UnitCase to cover with empty `[]` placementConstraints - Integration Tests ``` $ yarn integ test/aws-ecs/test/ec2/integ.placement-constraint-default-empty.js --update-on-failed ``` After integ tests were completed, `npm test` to verify the snapshot. ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
…aws#30382) ### Issue fixes aws#27555 Closes Half Fix [i.e, Allows user to give Empty Placement Constraints ] aws#27555 This PR does not address supporting empty placement strategies because of the following reason : [27555 : comment](aws#27572 (comment)) This was raised with the guidance from - [pr / 28431 : Comment ](aws#28431 (comment)) ### Reason for this change Users unable to give empty placementConstraints ### Description of how you validated changes - Added a UnitCase to cover with empty `[]` placementConstraints - Integration Tests ``` $ yarn integ test/aws-ecs/test/ec2/integ.placement-constraint-default-empty.js --update-on-failed ``` After integ tests were completed, `npm test` to verify the snapshot. ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Describe the bug
Altering PlacementConstraints and PlacementStrategies in CDK to remove them does not remove PlacementConstraints and Placement Strategies
Findings: the ECS UpdateService API used by CloudFormation allows for the use of an empty list passed to PlacementConstraints to remove existing placement constraints. The same applies to PlacementStrategies (though the documentation is less clear, and indicates "to remove an existing placement strategy, specify an empty object"), which implies CDK should emit a null here if strategies are empty/ should be removed.
Source: ECS API Reference
Status quo: CDK does not allow the use of an empty array for these properties as it evaluates PlacementConstraints using:
Lazy.any({ produce: () => this.constraints }, { omitEmptyArray: true })
Reference: Implementation
Therefore, setting PlacementConstraints to an empty array results in no property being generated. Furthermore, the use of an escape hatch (setting PlacementConstraints via
addPropertyOverride
does not seem to update this property.Expected Behavior
I expect to be able to update/ remove placement strategies and placement constraints. Removing the constraints triggers an update call without the parameter set, which means that the properties are not updated.
Current Behavior
Placement constraints cannot be removed easily. Placement strategies cannot be removed once set.
Reproduction Steps
Python code to reproduce the issue:
Possible Solution
CDK should always provide empty values for these parameters if they are not set, rather than not providing the parameters to avoid surprise on stack update when removing placement constraints.
Additional Information/Context
No response
CDK CLI Version
2.99.1
Framework Version
2.98.0
Node.js Version
18.16.0
OS
Mac OS
Language
Python
Language Version
Python (3.11.3)
Other information
No response
The text was updated successfully, but these errors were encountered: