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
Update the existing Data Source aws_ecs_cluster to also export an attribute for the defaultCapacityProviderStrategy, which is available via the DescribeClusters API
Use Case - when migrating ECS Clusters to use AWS Capacity Providers feature, we need to also migrate our existing ECS Services on that cluster. (New ECS Services automatically get this default strategy, but existing ones do not). In our case, our cluster resources are defined in different CI/CD pipelines than the ECS Services. If we could have Services query for any default strategy then use that, it would help with the migration process.
A workaround would be to use an External data source with AWS CLI commands to obtain this info, or to write out this metadata to TF state for querying via terraform_remote_state lookups.
New or Affected Resource(s)
aws_ecs_cluster
Potential Terraform Configuration
data "aws_ecs_cluster" "example" {
cluster_name = "example"
}
resource "aws_ecs_service" "myservice" {
...
# better alternative implementation would be to use a dynamic block to loop through each of the items in the array. This is simplified
capacity_provider_strategy {
capacity_provider = data.aws_ecs_cluster.example.default_capacity_provider_strategy[0].capacity_provider
weight = data.aws_ecs_cluster.example.default_capacity_provider_strategy[0].weight
base = data.aws_ecs_cluster.example.default_capacity_provider_strategy[0].base
}
}
Community Note
Description
Update the existing Data Source
aws_ecs_cluster
to also export an attribute for thedefaultCapacityProviderStrategy
, which is available via the DescribeClusters APIUse Case - when migrating ECS Clusters to use AWS Capacity Providers feature, we need to also migrate our existing ECS Services on that cluster. (New ECS Services automatically get this default strategy, but existing ones do not). In our case, our cluster resources are defined in different CI/CD pipelines than the ECS Services. If we could have Services query for any default strategy then use that, it would help with the migration process.
A workaround would be to use an External data source with AWS CLI commands to obtain this info, or to write out this metadata to TF state for querying via
terraform_remote_state
lookups.New or Affected Resource(s)
Potential Terraform Configuration
References
0000