-
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
terraform-plan doesn't properly detect deletion of ecs_service #3582
terraform-plan doesn't properly detect deletion of ecs_service #3582
Comments
Hey @davedash – do you have any configuration that demonstrates this? Was it a Task Definition that you removed? Or the actual thing that |
Hi @catsby I really have to tag my repo when I file a bug next time ;) I removed on the AWS console the actual ECS Service, not the task definition. |
I had the same problem (deleted the service, terraform got confused) - I created a stub service with the same name, did a |
I just reproduced this: resource "aws_ecs_cluster" "sleep" {
name = "helloworld-del-test"
}
resource "aws_ecs_task_definition" "sleep" {
family = "tf-helloworld-del-test"
container_definitions = <<TASK_DEFINITION
[
{
"name": "sleep",
"image": "busybox",
"cpu": 10,
"command": ["sleep","360"],
"memory": 10,
"essential": true
}
]
TASK_DEFINITION
}
resource "aws_ecs_service" "sleep" {
name = "sleep"
cluster = "${aws_ecs_cluster.sleep.id}"
task_definition = "${aws_ecs_task_definition.sleep.arn}"
desired_count = 1
} $ aws ecs update-service --service arn:aws:ecs:us-west-2:12060895217:service/sleep --cluster helloworld-del-test --desired-count 0
$ aws ecs delete-service --service arn:aws:ecs:us-west-2:12060895217:service/sleep --cluster helloworld-del-test The solution is to treat existing ECS service with state Here's a recap of my chat session with AWS support which helped me understand better how this workflow works:
|
See #3828 |
Hello, I believe this isn't entirely fixed, or I'm missing something. I have also manually "deleted" (via the AWS Console) a task definition which switched it to "inactive" state. However, when I try to run Terraform, Is this a bug? Am I doing something wrong? Output:
|
same as @elad with terraform ver0.99 |
does anybody know how to fix this? |
I was able to solve the inactive task definition issue with the example in the ECS task definition data source. You set up the ECS service resource to use the the max revision of either what your Terraform resource has created, or what is in the AWS console which the data source retrieves. The one downside to this is if someone changes the task definition, Terraform will not realign that to what's defined in code. |
still happening |
I've got the same issue using Terraform 0.11.3 AWS provider 1.11.0 and terragrunt 0.14.2, make a static configuration of the ECS services is a shame IMHO, just trying to use the ECS task definition data source is not working (I'm using the count pattern in this cluster too)
But taking a look to the state...
|
The inactive task definition problem was resolved for me by hashicorp/terraform-provider-aws#5565 |
If a task definition is marked as INACTIVE in ECS then terraform should treat it as a deleted resource Resolves: hashicorp/terraform#3582 (comment) Signed-off-by: Edward Wilde <ewilde@gmail.com>
Still happening with When I manually delete an ECS service in the AWS interface that was created with a
And then applying that plan renders this error:
The particular workaround in my case is to just make a plan and apply it again, without having to do anything else. Someone let me know if you need more context. |
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. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
I manually removed an ECS service definition via the AWS console.
I ran terraform plan and got:
What I expected was a new service to be created.
After running apply (just for kicks):
The text was updated successfully, but these errors were encountered: