-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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_ecs_capacity_provider_attachment #11531
Comments
Hi @carlosrodf 👋 Thank you for submitting this. Can you please elaborate more on the use case that requires this second configuration method? In general, the support of two separate ways of configuring the same infrastructure can be confusing for operators and we need to make concessions with expected Terraform functionality to allow this (e.g. disabling drift detection in the ECS Cluster resource in this case). Another downside here is that unlike a few of our other "attachment" resources, only one of these would be able to be configured per ECS Cluster, which is the same as it exists today. |
@bflad what I noticed is that once created with the current methods available in terraform there is no way to modify or even delete the resource because of the name restriction. When i modify any of the attributes in the
And even if i remove all the capacity provider related stuff from my terraform code i get the same error when it attempts to delete it. |
This would solve the issue I reported in #11409 - indeed see that it matches what I suggested there as a possible solution. |
I'm facing the same issues right now. I am trying to integrate a capacity provider into my code but cannot get it to work reliably. As @lukedd mentioned the ECS cluster has an indirect dependency on the auto scaling group and updates become impossible once the capacity provider is created because of the name restriction mentioned by @carlosrodf. I think an attachment resource would make this a lot more flexible, right now the only solution I found was using a random_pet resource with capacity provider.
|
I spoke too soon, using a random_pet will not work. |
Any update on this feature? I know that the AWS API is a constraint here because it doesn't allow to update nor delete the CP but an attachment resource would make this more flexible |
Another use case of this is: I cannot find where to associate the Capacity Provider with ECS cluster which created by aws_batch_compute_environment Our use case is first create AWS batch compute environment with UNMANAGED type, which will automatically create the ECS cluster. Then, we create the Launch Template, AutoScaling Group. After that, go to the ECS Cluster created by batch compute, and create the Capacity Provider. I try to use the resource aws_ecs_cluster with the ECS cluster name created by aws_batch_compute_environment, and aws_ecs_capacity_provider.resource.name but got error
More info on #24615 |
This is the show stopper right now to using capacity providers in my setups, since the ASG and the ECS cluster get created in separate modules (for multiple ec2 deployment groups within one ecs) |
This would solve a few workarounds I've had to implement. Specially on use cases where we're working with legacy clusters that weren't created using Terraform. |
provisioner "local-exec" {
command = "/usr/bin/aws ecs put-cluster-capacity-providers --cluster ${aws_ecs_cluster.this.name} --capacity-providers ${aws_ecs_capacity_provider.this.name} --default-capacity-provider-strategy capacityProvider=${aws_ecs_capacity_provider.this.name},weight=128,base=128 --region ${data.aws_region.current.name}"
# interpreter = ["/bin/sh"]
}
} This is a workaround that I used to have but: whenever something changes on the capacity provider or ecs-cluster there is no notification to the attachment itself; so it is useless |
Hi Guys, what is the status on this besides being open? What exactly blocks this issue? |
Just hit the bug described in #11409. This PR seems like the right fix, for as it is now, capacity providers are broken in Terraform, as you get an invalid dependency chain: |
I have an even worse problem, in that I create a full circular dependency because I reference aws_ecs_cluster.this.name in the user data for the launch template (as part of the cluster registration)
I'm getting around it, of course, by having the name of the cluster and the reference in the launch template just both point to a local variable, but this attachement stuff would break the loop too. |
Hi, |
Any update on this issue? |
This functionality has been released in v3.74.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. |
Community Note
Relates #11409
Description
Add the ability to attach an existing aws_ecs_capacity_provider to an existing aws_ecs_cluster resource. Right now we can only do it on the aws_ecs_cluster resource definition. Creating and Deleting this attachment resource would act like this cli functionality https://docs.aws.amazon.com/cli/latest/reference/ecs/put-cluster-capacity-providers.html
New or Affected Resource(s)
Potential Terraform Configuration
References
The text was updated successfully, but these errors were encountered: