Terraform-provider-aws: Add deletion support for ECS Cluster Capacity Providers

Created on 14 Dec 2019  ·  6Comments  ·  Source: hashicorp/terraform-provider-aws

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

The AWS ECS API does not yet support deletion of cluster capacity providers, but there is an open issue on the ECS roadmap to address this: https://github.com/aws/containers-roadmap/issues/632.

Once this is implemented, add it to the aws_ecs_capacity_provider resource.

New or Affected Resource(s)

  • aws_ecs_capacity_provider

References

  • #11151
enhancement servicecs upstream

Most helpful comment

Please let me know if I'm understanding the consequences of not being able to actually delete the aws_ecs_capacity_provider resource correctly.

Currently, if I remove the resource from my config, it's simply removed from the state file, but the capacity provider still exists within AWS. If the removed capacity provider is associated with an Autoscaling Group, the existing Autoscaling Group continues to have the removed capacity provider associated with it.

Since the aws_ecs_capacity_provider resource is unable to be modified, if I make a change to my resource configuration for it, the resource is removed from the terraform state and a new one attempts to be created. Even if I make sure that the name doesn't collide with the previously tracked ECS capacity provider by using the random provider or something, the creation of the new capacity provider still fails due to the Autoscaling Group (which has not been deleted or altered) only being allowed to have a single capacity provider associated with it.

Does this sound accurate? If so, is there a way to have terraform know to remove the association between the old capacity provider and the Autoscaling Group while still keeping the Autoscaling Group around?

All 6 comments

Please let me know if I'm understanding the consequences of not being able to actually delete the aws_ecs_capacity_provider resource correctly.

Currently, if I remove the resource from my config, it's simply removed from the state file, but the capacity provider still exists within AWS. If the removed capacity provider is associated with an Autoscaling Group, the existing Autoscaling Group continues to have the removed capacity provider associated with it.

Since the aws_ecs_capacity_provider resource is unable to be modified, if I make a change to my resource configuration for it, the resource is removed from the terraform state and a new one attempts to be created. Even if I make sure that the name doesn't collide with the previously tracked ECS capacity provider by using the random provider or something, the creation of the new capacity provider still fails due to the Autoscaling Group (which has not been deleted or altered) only being allowed to have a single capacity provider associated with it.

Does this sound accurate? If so, is there a way to have terraform know to remove the association between the old capacity provider and the Autoscaling Group while still keeping the Autoscaling Group around?

@sam-hart-swanson I think, based on https://github.com/aws/containers-roadmap/issues/632#issuecomment-562454562 and https://github.com/aws/containers-roadmap/issues/632#issuecomment-564253687, that the association is permanent, and that both the Capacity Provider and ASG have to be recreated, even using the raw AWS API.

I stuck into the problem of cluster not getting destroyed due to the bug/design of aws_ecs_capacity_provider not getting deleted.I have to bypass and directly delete ASG in order to delete the cluster.Clearly this stops from creating clusters from terraform or likes

Support for the new deletion API has been merged and will release with version 2.67.0 of the Terraform AWS Provider, later this week. 👍

This has been released in version 2.67.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 for triage. Thanks!

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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

Was this page helpful?
0 / 5 - 0 ratings