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

Fix issue preventing replacing when ASG capacity provider is associated with a cluster #39720

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

YukiMichishita
Copy link

Description

This pull request resolves issue #14393.

The aws_ecs_cluster_capacity_providers resource depends on the aws_ecs_capacity_provider. Currently, when the aws_ecs_capacity_provider is force replaced due to a rename or other modification, the aws_ecs_cluster_capacity_providers is updated in-place. However, in AWS, deleting a capacity_provider via API fails if it is still associated with a cluster (which corresponds to the cluster_capacity_provider resource in Terraform). This is the root cause of issue #14393. What this means is that the aws_ecs_cluster_capacity_providers must be deleted before the aws_ecs_capacity_provider can be deleted.

The solution is to enable force new on the capacity_providers argument within the aws_ecs_cluster_capacity_providers. This ensures that when a aws_ecs_capacity_provider is force replaced, the aws_ecs_cluster_capacity_providers is also force replaced, allowing the association with the cluster to be removed before the aws_ecs_capacity_provider is deleted. This resolves the issue.

Relations

Closes #14393

References

Output from Acceptance Testing

The test case TestAccECSClusterCapacityProviders_destroy is failing, but as reported in issue #38408, this is a failing test even in the latest main branch, and is not caused by this pull request.

% make testacc TESTS=TestAccECSClusterCapacityProviders_* PKG=ecs

    cluster_capacity_providers_test.go:120: Step 1/2 error: Check failed: Check 2/2 error: RegisteredContainerInstancesCount = 0, want 2
--- PASS: TestAccECSClusterCapacityProviders_defaults (59.27s)
--- PASS: TestAccECSClusterCapacityProviders_basic (59.30s)
--- PASS: TestAccECSClusterCapacityProviders_disappears (63.42s)
--- PASS: TestAccECSClusterCapacityProviders_Rename_CapacityProvider (109.37s)
--- PASS: TestAccECSClusterCapacityProviders_Update_defaultStrategy (125.55s)
--- PASS: TestAccECSClusterCapacityProviders_Update_capacityProviders (157.86s)
--- FAIL: TestAccECSClusterCapacityProviders_destroy (168.53s)
FAIL
FAIL    github.com/hashicorp/terraform-provider-aws/internal/service/ecs        177.279s
FAIL
make: *** [testacc] Error 1

@YukiMichishita YukiMichishita requested a review from a team as a code owner October 15, 2024 10:06
Copy link

Community Note

Voting for Prioritization

  • Please vote on this pull request by adding a 👍 reaction to the original post to help the community and maintainers prioritize this pull request.
  • Please see our prioritization guide for information on how we prioritize.
  • 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.

For Submitters

  • Review the contribution guide relating to the type of change you are making to ensure all of the necessary steps have been taken.
  • For new resources and data sources, use skaff to generate scaffolding with comments detailing common expectations.
  • Whether or not the branch has been rebased will not impact prioritization, but doing so is always a welcome surprise.

@github-actions github-actions bot added tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. service/ecs Issues and PRs that pertain to the ecs service. needs-triage Waiting for first response or review from a maintainer. labels Oct 15, 2024
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Welcome @YukiMichishita 👋

It looks like this is your first Pull Request submission to the Terraform AWS Provider! If you haven’t already done so please make sure you have checked out our CONTRIBUTOR guide and FAQ to make sure your contribution is adhering to best practice and has all the necessary elements in place for a successful approval.

Also take a look at our FAQ which details how we prioritize Pull Requests for inclusion.

Thanks again, and welcome to the community! 😃

@YukiMichishita YukiMichishita changed the title Fix issue preventing replacing when ASG capacity provider Fix issue preventing replacing when ASG capacity provider is associated with a cluster Oct 16, 2024
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. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

aws_ecs_capacity_provider will not destroy properly when needing replacement.
1 participant