aws_ecs.service: Cannot update service if service revisions is active
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 83
Description
### Describe the bug
When an ECS service has service revisions enabled, cdk cannot update the associated stack unless other stack changes trigger a re-deployment.
### Regression Issue
- [ ] Select this option if this issue appears to be a regression.
### Last Known Working CDK Version
_No response_
### Expected Behavior
I would expect that cdk would handle this state gracefully/consistently and not leave the stack in an unmodifiable state.
In the current config, our preference would be for cdk to handle this change even if the revision has been triggered externally by a CD tool. I get that ideally, CD might trigger a CDK update to the stack rather than having it triggered by another tool, but that type of gitops config isn't always possible.
### Current Behavior
"Invalid request provided: UpdateService error: TaskDefinition is inactive (Service: AmazonECS; Status Code: 400; Error Code: ClientException"
I have attempted this change when with the task definition versioning managed by CDK and without (task def updated by CLI). Both produce the same error.
### Reproduction Steps
Deploy a service.
Deploy a revision of the service. (via cdk or cli)
Attempt to update the stack with changes that do not trigger a service re-deployment (like replica count).
### Possible Solution
This appears to be because ECS keeps the prior revision attached to the service, but set as inactive. Example: If I select the "source" revision in the screenshot above, that task definition version is listed as inactive. This makes sense, but possibly there is a way to safely handle this by either triggering a re-deploy or ignoring the inactive revision.
### Additional Information/Context
_No response_
### CDK CLI Version
2.176.0
### Framework Version
_No response_
### Node.js Version
18.16
### OS
MacOS Sequoia
### Language
TypeScript
### Language Version
_No response_
### Other information
_No response_
Contributor guide
Research direction
The issue names no files or tests. Start by reproducing the ECS service update after activating a service revision, then trace the CDK ECS service update path that produces the inactive TaskDefinition error. Done means a stack change such as replica count can be applied consistently without the reported ECS failure.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, typescript
- Domain
- cloud, infrastructure
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100