-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
force_new_deployment does not redeploy the ecs service #13528
Comments
same issue here. no changes - even if new image is behind image:tag |
Hi folks 👋 Terraform needs some value to show a difference for the resource update function to run. If there are no updates, the update function (and the call to force new deployment) cannot be triggered. We may be able to work around this by introducing a new "triggers" argument, similar to the API Gateway deployment resources, to allow operators to provide their own redeployment criteria outside a lack of ECS service configuration changes. |
Running into the same. Expecting it to drop the service to 1 task, deploy, drop to 1 again, deploy. It results in a no-op, but works from the console. Since the intent of Outside of (off the top of my head) versioning the task/images, there's no way to force this at the moment right? |
@Kevin-Molina
Those will be updated due to |
In this case the document is misleading because it also stated that :
Maybe the documentation should be updated to remove that statement , I see lot of people being confused but this and spending time trying to debug something that obviously isn't expected to work that way |
In this case the document is misleading because it also stated that :
Maybe the documentation should be updated to remove that statement , I see lot of people being confused by this and spend/wast time trying to debug something that obviously isn't expected to work that way |
For the time being it would be possible to change the value of a tag to get this behavior but Terraform tries to be smart in conn := meta.(*AWSClient).ecsconn
updateService := aws.Bool(d.Get("force_new_deployment").(bool))
input := ecs.UpdateServiceInput{
Cluster: aws.String(d.Get("cluster").(string)),
ForceNewDeployment: updateService,
Service: aws.String(d.Id()),
} so that users could change the value of a tag and get the service redeployed. |
Any update or workaroundon this? How to force update (recreation) of task if there are no changes in the task definition or service config? |
Same issue here |
As a workaround, you can use the docker image digest as part of container definition, to trick terraform to see a change in state and thus create a new task definition, which will enforce service redeploy.
The downside is a new task definition created with every deployment if that concerns you. More details are available here: |
very nice @amithkumarg |
Thanks for the great solution! This might be a trivial thing, but I leave the description here so that others will not be confused. According to the AWS guide, you can choose the image name format.(https://docs.aws.amazon.com/AmazonECR/latest/userguide/docker-pull-ecr-image.html) It is described as below.
So, when you want to pull by digest, you can write like If you use both of tag and digest, it might case error like “not found: does not exist”. Have a nice day! |
opened a PR that (I think) will address this: #25840 resource "aws_ecs_service" "foo" {
...
force_new_deployment = true
triggers = {
update = timestamp() # force update in-place every apply
}
} |
Hi there, any update there? |
Closed by #25840 |
This functionality has been released in v4.40.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you! |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. |
Terraform Version
0.12.18
Affected Resource(s)
aws_ecs_service
Terraform Configuration Files
Expected Behavior
When force_new_deployment is set to true and you perform a terraform run, the service should be redeployed. All other settings remain the same including the ECS image tag.
Actual Behavior
Terraform reports that there is nothing to redeploy and the service isn't redeployed:
No changes. Infrastructure is up-to-date.
Steps to Reproduce
The text was updated successfully, but these errors were encountered: