Skip to content

Conversation

@kidbomb
Copy link

@kidbomb kidbomb commented Dec 12, 2025

Rollback Plan

If a change needs to be reverted, we will publish an updated version of the library.

Changes to Security Controls

Are there any changes to security controls (access controls, encryption, logging) in this pull request? If so, explain.

Description

When a capacity provider is addded to a aws_ecs_cluster_capacity_providers resource immediately after created, the operation fails with the following error:

Error: updating ECS Cluster Capacity Providers (terratest-k25y8v-cluster): operation error ECS: PutClusterCapacityProviders, https response error StatusCode: 400, RequestID: a6d97514-91ba-4726-a6a2-63dd645f7af4, InvalidParameterException: The specified capacity provider 'capacity-provider-terratest-k25y8v-cluster' is not in an ACTIVE state. Specify a valid capacity provider and try again.

My current terraform code looks like this:

resource "aws_ecs_cluster_capacity_providers" "ecs_provider" {
  count = var.cluster_name != null && var.cluster_name != "" ? 1 : 0

  cluster_name = var.cluster_name
  capacity_providers = [
    aws_ecs_capacity_provider.ecs.name
  ]

  default_capacity_provider_strategy {
    capacity_provider = aws_ecs_capacity_provider.ecs.name
    weight            = 100
  }
}

resource "aws_ecs_capacity_provider" "ecs" {

  name    = substr(local.capacity_provider_name, 0, 255)
  tags    = var.tags
  cluster = var.cluster

  dynamic "auto_scaling_group_provider" {
    for_each = local.use_asg_provider ? [1] : []
    content {
      auto_scaling_group_arn         = data.aws_autoscaling_group.asg[0].arn
      managed_termination_protection = var.managed_termination_protection

      managed_scaling {
        maximum_scaling_step_size = var.maximum_scaling_step_size
        minimum_scaling_step_size = var.minimum_scaling_step_size
        status                    = var.status
        target_capacity           = var.target_capacity
      }
    }
  }

Relations

Closes #0000

References

Output from Acceptance Testing

% make testacc TESTS=TestAccXXX PKG=ec2

...

@kidbomb kidbomb requested a review from a team as a code owner December 12, 2025 17:22
@github-actions
Copy link
Contributor

Community Guidelines

This comment is added to every new Pull Request to provide quick reference to how the Terraform AWS Provider is maintained. Please review the information below, and thank you for contributing to the community that keeps the provider thriving! 🚀

Voting for Prioritization

  • Please vote on this Pull Request by adding a 👍 reaction to the original post to help the community and maintainers prioritize it.
  • Please see our prioritization guide for additional information on how the maintainers handle prioritization.
  • Please do not leave +1 or other comments that do not add relevant new information or questions; they generate extra noise for others following the Pull Request and do not help prioritize the request.

Pull Request Authors

  • Review the contribution guide relating to the type of change you are making to ensure all of the necessary steps have been taken.
  • Whether or not the branch has been rebased will not impact prioritization, but doing so is always a welcome surprise.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 12, 2025

✅ Thank you for correcting the previously detected issues! The maintainers appreciate your efforts to make the review process as smooth as possible.

@github-actions github-actions bot added needs-triage Waiting for first response or review from a maintainer. service/ecs Issues and PRs that pertain to the ecs service. size/S Managed by automation to categorize the size of a PR. labels Dec 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-triage Waiting for first response or review from a maintainer. service/ecs Issues and PRs that pertain to the ecs service. size/S Managed by automation to categorize the size of a PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant