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

Cannot associate the Capacity Provider with ECS cluster which created by aws_batch_compute_environment #12749

Closed
ghost opened this issue Apr 9, 2020 · 5 comments
Labels
new-resource Introduces a new resource. service/ecs Issues and PRs that pertain to the ecs service.

Comments

@ghost
Copy link

ghost commented Apr 9, 2020

This issue was originally opened by @ctrongminh as hashicorp/terraform#24615. It was migrated here as a result of the provider split. The original body of the issue is below.


Current Terraform Version

Terraform v0.12.24

Use-cases

Our use case is first create AWS batch compute environment with UNMANAGED type, which will automatically create the ECS cluster. Then, we will create the Launch Template, AutoScaling Group. After that, go to the ECS Cluster, and create the Capacity Provider.
However, I cannot find a way to associate the ECS Cluster created by aws_batch_compute_environment with the resource aws_ecs_capacity_provider.

Attempted Solutions

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.

There are three cases

  1. Define both capacity_providers and default_capacity_provider_strategy

resource "aws_ecs_cluster" "resource" {
name = "${trimprefix(data.aws_arn.ecs-cluster-resource.resource, "cluster/")}"
capacity_providers = ["${aws_ecs_capacity_provider.resource.name}"]

default_capacity_provider_strategy {
capacity_provider = "${aws_ecs_capacity_provider.resource.name}"
}
}

Got error

Error: InvalidParameterException: Arguments on this idempotent request are inconsistent with arguments used in previous request(s).
  1. Only use the capacity_providers

resource "aws_ecs_cluster" "resource" {
name = "${trimprefix(data.aws_arn.ecs-cluster-resource.resource, "cluster/")}"
capacity_providers = ["${aws_ecs_capacity_provider.resource.name}"]
}
Got the same error

Error: InvalidParameterException: Arguments on this idempotent request are inconsistent with arguments used in previous request(s)
  1. Ony use the default_capacity_provider_strategy

resource "aws_ecs_cluster" "resource" {
name = "${trimprefix(data.aws_arn.ecs-cluster-resource.resource, "cluster/")}"
default_capacity_provider_strategy {
capacity_provider = "${aws_ecs_capacity_provider.resource.name}"
}
}
Got different error

Error: InvalidParameterException: The specified capacity provider strategy cannot contain a capacity provider that is not associated with the cluster. Associate the capacity provider with the cluster or specify a valid capacity provider and try again.

Proposal

References

#11531

@ghost ghost added the service/ecs Issues and PRs that pertain to the ecs service. label Apr 9, 2020
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Apr 9, 2020
@bflad bflad added new-resource Introduces a new resource. and removed needs-triage Waiting for first response or review from a maintainer. labels Apr 9, 2020
@bflad bflad self-assigned this Apr 9, 2020
@ctrongminh
Copy link

This issue happens on:

  • provider.aws v2.53.0

@ShitulGupta
Copy link

This happens on v2.70.0 too . can someone help ..?

@awsgopsguru
Copy link

@DrFaust92
Copy link
Collaborator

Closed via #22672

@github-actions
Copy link

github-actions bot commented May 5, 2022

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
new-resource Introduces a new resource. service/ecs Issues and PRs that pertain to the ecs service.
Projects
None yet
Development

No branches or pull requests

5 participants