-
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
aws_appautoscaling_policy gets removed if aws_ecs_service got re-created #10432
Comments
This issue gets reproduced even if I explicit dependency on aws_ecs_service using depends_on |
Also, surprisingly terraform does not show in the plan or apply that appautoscaling policy is getting destroyed. |
This issue is same as #5747 which is marked fixed in v 2.3.0 of the Terraform AWS provider. However this was tested on v2.23.0 and v2.24.0 and it fails on both. Is this possibly a regression? |
@bflad, |
I think issue #5747 (PR #7982) was just for the relationship between autoscaling policy and target. Your issue is between the target and the ECS service. I ran into the same issue and was able to do a temporary workaround via using an empty interpolation of the unknown property
resource "aws_appautoscaling_target" "service" {
service_namespace = "ecs"
resource_id = "service/${var.cluster_name}/${aws_ecs_service.service.name}${replace(aws_ecs_service.service.id, "/.*/", "")}"
scalable_dimension = "ecs:service:DesiredCount"
min_capacity = var.autoscaling_min_count
max_capacity = var.autoscaling_max_count
} |
Hey @ahujarajesh 👋 Thank you for taking the time to file this issue! Given that there's been a number of AWS provider releases since you initially filed it, and the workaround provided above, can you confirm whether you're still experiencing this behavior? |
We just hit this issue with v3.71.0 of the AWS provider. Can it be that AWS removes the resources in order to unblock destruction of the ECS service, and so the problem is invisible to Terraform until it runs again? |
Hey @marksumm 👋 Thanks for confirming you're still experiencing this. I've marked this as a bug so that we can look into it as soon as time allows. |
We were also having this issue. @danieladams456 work around worked for us, but seems like it shouldn't be necessary. This issue has been open for almost four years. |
Community Note
Terraform Version
Affected Resource(s)
Terraform Configuration Files
Debug Output
Not Applicable
Panic Output
Not Applicable
Expected Behavior
If ECS Service gets destroyed and recreated then aws_appautoscaling_policy should also get created.
Actual Behavior
When ECS Service gets destroyed and recreated aws_appautoscaling_policy gets destroyed.
Steps to Reproduce
Create aws_ecs_task_definition, aws_ecs_service, aws_lb_target_group, aws_lb_listener_rule, aws_appautoscaling_target, aws_appautoscaling_policy
.Run terraform apply
Change anything in aws_ecs_service so it will trigger destroy and recreate of aws_ecs_service
Run terraform apply
The text was updated successfully, but these errors were encountered: