Skip to content
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

Error creating Capacity Providers on ECS Cluster #11338

Closed
encryptblockr opened this issue Dec 18, 2019 · 8 comments · Fixed by #11446
Closed

Error creating Capacity Providers on ECS Cluster #11338

encryptblockr opened this issue Dec 18, 2019 · 8 comments · Fixed by #11446
Labels
documentation Introduces or discusses updates to documentation. service/ecs Issues and PRs that pertain to the ecs service.
Milestone

Comments

@encryptblockr
Copy link

getting these errors with this push
using latest terraform and latest aws provider

$ terraform --version
Terraform v0.12.18
+ provider.aws v2.42.0
+ provider.template v2.1.2
Error: error creating capacity provider: ClientException: The managed termination protection setting for the capacity provider is invalid. To enable managed termination protection for a capacity provider, the Auto Scaling group must have instance protection from scale in enabled.

i have enabled protect_from_scale_in = true for the autoscaling group so not sure what the issue is

References
#11151

@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Dec 18, 2019
@encryptblockr
Copy link
Author

ok this works now

i think was issue with my autoscaling group not able to update when launch configuration changes so i fixed that and now i am able to create capacity provider

BUT when the capacity provider was created after a successful terraform apply, i am not able to see it under the "capacity providers" tab of the ECS cluster

am i missing anything? where do i see the capacity provider created by terraform?

@encryptblockr
Copy link
Author

here is latest when trying to attach the capacity provider created to the ECS cluster
capacity provider arn:aws:ecs:abc123 and was able to even reference it in my terraform which is why it can even have a capacity provider to search..but now can't find it

Error: error changing ECS cluster capacity provider settings (arn:aws:ecs:abc123): InvalidParameterException: The specified capacity provider 'arn:aws:ecs:abc123' was not found. Specify a valid capacity provider and try again.

@encryptblockr
Copy link
Author

final update!

when i used name of capacity provider instead of the arn then it works
this is a bug!

works now when i referenced the capacity provider by the name
did not work when i referenced by the arn

@MBali-GitHub
Copy link

@encryptblockr : Can you share the syntax you've used, and did you hardcode the value?

It works fine when I hard code the name of the capacity provider
capacity_providers = ["mytest"] ---- This works

But it throws an error when i try to refer it like
capacity_providers = ["${aws_ecs_capacity_provider.capacityProvider.name}"] ----This does not work

The error doesn't give any details, and just names some resources in my project.
Cycle: module.ecs_cluster.aws_launch_template.launchTemplate, module.ecs_cluster.aws_autoscaling_group.asg, module.ecs_cluster.aws_ecs_capacity_provider.capacityProvider, module.ecs_cluster.aws_ecs_cluster.ecsCluster, module.ecs_cluster.data.template_file.user_data

@eversC
Copy link

eversC commented Dec 27, 2019

I'm seeing the same as @encryptblockr where name of capacity provider works but arn doesn't, yet the provider docs for ecs_cluster state:

capacity_providers - (Optional) List of short names or full Amazon Resource Names (ARNs) of one or more capacity providers to associate with the cluster. Valid values also include FARGATE and FARGATE_SPOT.

@ItsKarma
Copy link
Contributor

ItsKarma commented Dec 31, 2019

I was also able to confirm using the name instead of the arn worked for both capacity_providers and default_capacity_provider_strategy{capacity_provider}.

This appears to only be an issue with the Terraform documentation. The aws cli docs do not indicate the full arn can be used, but only the name of the capacity provider(s).

--capacity-providers (list)
The name of one or more capacity providers to associate with the cluster.

EDIT: I have found the source markdown and am working on a pull request to update the documentation.

@bflad bflad added documentation Introduces or discusses updates to documentation. service/ecs Issues and PRs that pertain to the ecs service. and removed needs-triage Waiting for first response or review from a maintainer. labels Jan 2, 2020
@bflad bflad added this to the v2.44.0 milestone Jan 2, 2020
@ghost
Copy link

ghost commented Jan 10, 2020

This has been released in version 2.44.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!

@ghost
Copy link

ghost commented Mar 27, 2020

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!

@ghost ghost locked and limited conversation to collaborators Mar 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Introduces or discusses updates to documentation. service/ecs Issues and PRs that pertain to the ecs service.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants