Open saidkharboutli opened 10 months ago
@saidkharboutli Can you add a source on where you found the property forceNewDeployment
?
I had a look at the CloudFormation documentation, but I could not find it: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-service.html
@daschaa Upon further investigation, you do seem to be right--it's only a property in Terraform, and it's under another name (not camelCase).
Though regardless of its availability in CDK/Terraform now, if it's an option available in the AWS console, should we not be able to set it programmatically? There may be a reason it's not available, but it would be useful for the many people that have posted about this exact issue.
@saidkharboutli I totally agree with you that the goal should be to cover the functionalities which you also have in the AWS console. However, if the field is not available in CloudFormation, we need to wait until CloudFormation implemented this. I guess you could technically also implement a workaround with a custom resource and the AWS SDK, but I think the maintainers of the CDK are hesitant to implement new custom resources.
I would suggest to put a flag needs-cfn
to this issue and leave it open.
Thanks @saidkharboutli for reporting this. Thanks @daschaa for your investigation.
It is not supported by cloudformation yet. However one can submit a FR for this to be added on the Cloudformation coverage roadmap.
@daschaa I appreciate your time on this endeavor greatly! I will likely take this over to the Cfn team then, and then perhaps once it is ready, this can be my first PR on the CDK project.
Thanks @khushail, I'll make that FR before I leave work today.
I'm adding the reference for the FR on CFN-github repo here: https://github.com/aws-cloudformation/cloudformation-coverage-roadmap/issues/1776 - Please up-vote this linked issue, to make CFN team aware of this.
Describe the bug
Hello,
I just noticed that my CDK script has been doing every step of my NodeJS backend deployment except for restarting my ECS service upon ECR image update. There seems to be numerous threads on this specific issue, and the common answer is to use
forceNewDeployment
, which can be set from the CLI as well as within the Fargate service definition.Currently, I am able to go into the AWS dashboard and manually check
forceNewDeployment
but that isn't the programmatic solution I am looking for. Also, once AWS spins up the new service and removes the old one, I have to check the option again for the next deployment.The real underlying issue is that, for some reason, the FargateServiceProps interface has no mention of this specific option. I am really not sure why, given that this issue of updating the ECS service after an ECR update is pretty wide-spread.
Expected Behavior
I should be able to set the
forceNewDeployment
to true for the service when it is first built and thereafter. I really just want the ECS service to restart without downtime when the ECR image updates. If there is another way to do this that I have missed, please do let me know.Current Behavior
forceNewDeployment
is not included as an option when creating an ECS service with CDK. Even checking it manually in the console does not stick, as the current service will spin down after the new one (that has the option set to False by default) is spun up.Reproduction Steps
Not certain if there are reproduction steps--it moreso a lack of an important field within the service definition.
Possible Solution
Allow
forceNewDeployment
to be set to true for the creation of every service, forcing new ECS services to take the place of old ones when a new image is pushed to ECR.Additional Information/Context
No response
CDK CLI Version
2.103.1
Framework Version
No response
Node.js Version
20.9.0
OS
Ubuntu
Language
TypeScript
Language Version
No response
Other information
No response