_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._
Terraform v0.12.24
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.
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
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).
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)
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.
This issue happens on:
This happens on v2.70.0 too . can someone help ..?