hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.78k stars 9.13k forks source link

[Bug]: Inconsistent behaviour between aws_ecs_service resource and data source for deleted services #30719

Open sblask opened 1 year ago

sblask commented 1 year ago

Terraform Core Version

1.4.2

AWS Provider Version

4.62.0

Affected Resource(s)

Expected Behavior

The aws_ecs_service data source should only return active services or have a parameter that allows for filtering on the status. I didn't test it, but it's probably the same for the aws_ecs_cluster

Actual Behavior

The aws_ecs_service data source seems to return the same as a call to aws ecs delete-service which includes services with status INACTIVE (i.e. deleted services). That is counter intuitive because the service is no longer visible in the Console. This is also inconsistent with the aws_ecs_service resource which shows services as deleted when they were deleted in the Console and tries to re-create them. It is made worse by the fact that the status is not one of the attributes of the data source, so from the terraform side it is not possible to see what is going on.

Relevant Error/Panic Output Snippet

No response

Terraform Configuration Files

# it will be easiest to create an ECS cluster and service in the Console and then copy the relevant values here
data "aws_ecs_service" "service" {
  cluster_arn  = "cluster_arn"
  service_name = "service_name"
}
output "service" {
  value = aws_ecs_service.service
}

Steps to Reproduce

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

None

github-actions[bot] commented 1 year ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue