cdk-ecs-codedeploy icon indicating copy to clipboard operation
cdk-ecs-codedeploy copied to clipboard

Can't change defaultCloudMapNamespace on the cluster

Open Ismael opened this issue 2 years ago • 8 comments

While changing the ECS defaultCloudMapNamespace, a deployment causes this error:

Resource handler returned message: "Invalid request provided: UpdateService error: Unable to update task definition on services with a CODE_DEPLOY deployment controller. Use AWS CodeDeploy to trigger a new deployment. (Service: AmazonECS; Status Code: 400; Error Code: InvalidParameterException

Is there any way to force the deployment using this construct? Or any other way around?

Ismael avatar Apr 14 '23 21:04 Ismael

Can you share a snippet of code where you used the construct?

cplee avatar Apr 14 '23 23:04 cplee

I built an app to show the issue. It seems I was mistaken on the source of the issue, it triggers the error when adding cloudMapOptions to an Ec2Service, line 140 at ecstest-stack.ts .

Clone the code from: https://github.com/Ismael/cdkecstest , edit bin/ecstest.ts with your vpc and ecs codedeploy role. Deploy once, then uncomment after line 140 and deploy. This should trigger the error.

Ismael avatar Apr 17 '23 19:04 Ismael

Does it only fail if you deploy first without cloudmap and then update stack to add cloudmap?

cplee avatar Apr 18 '23 14:04 cplee

Yes.

Ismael avatar Apr 18 '23 15:04 Ismael

Thanks for the sample code. Unfortunately, this is a limitation with configuring ECS Services to use CODE_DEPLOY for the deployment controller. See: https://github.com/aws/aws-cdk/issues/23564

cplee avatar Apr 19 '23 16:04 cplee

Is there any workaround? I don't know enough about the internals, but maybe using cdk to create only the task definition and using EcsDeployment to actually trigger it?

Ismael avatar Apr 19 '23 16:04 Ismael

No, not that I'm aware of.

cplee avatar Apr 25 '23 16:04 cplee

I found the upstream issue was recently closed as shipped: https://github.com/aws-cloudformation/cloudformation-coverage-roadmap/issues/1529 Is this issue still relevant?

tmokmss avatar Apr 02 '24 09:04 tmokmss