Skip to content

resource/aws_ecs_service: allow in-place removal of managed EBS volume_configuration - #49185

Open
mealingr wants to merge 2 commits into
hashicorp:mainfrom
mealingr:b-ecs-service-volume-configuration-removal
Open

resource/aws_ecs_service: allow in-place removal of managed EBS volume_configuration#49185
mealingr wants to merge 2 commits into
hashicorp:mainfrom
mealingr:b-ecs-service-volume-configuration-removal

Conversation

@mealingr

Copy link
Copy Markdown

Rollback Plan

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

Changes to Security Controls

None.

Description

Removing a managed EBS volume from an existing aws_ecs_service (deleting the volume_configuration block) currently fails on apply:

InvalidParameterException: Volume configuration provided but no matching configuredAtLaunch volume found in task definition

On update, the emptied volume_configuration was passed straight to expandServiceVolumeConfigurations, which returns nil for an empty list. UpdateService treats a nil volumeConfigurations as "no change" and keeps the existing volume configuration, which then conflicts with the new task-definition revision whose volume is no longer configuredAtLaunch.

AWS documents removal as passing an empty volumeConfigurations array together with a task definition whose volume has configuredAtLaunch = false (Configure a service to no longer utilize Amazon EBS volumes). This seeds an empty slice before conditionally expanding, mirroring how placement_constraints already handles removal in the same function. Enable/resize are unchanged.

References

https://docs.aws.amazon.com/AmazonECS/latest/developerguide/configure-ebs-volume.html

Output from Acceptance Testing

% make testacc TESTS=TestAccECSService_VolumeConfiguration_remove PKG=ecs
TF_ACC=1 go test ./internal/service/ecs/... -run='TestAccECSService_VolumeConfiguration_remove' -timeout 360m
=== RUN   TestAccECSService_VolumeConfiguration_remove
--- PASS: TestAccECSService_VolumeConfiguration_remove (90.81s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/ecs	90.958s

@mealingr
mealingr requested a review from a team as a code owner July 29, 2026 15:17
@dosubot dosubot Bot added the bug Addresses a defect in current functionality. label Jul 29, 2026
@github-actions

Copy link
Copy Markdown
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

github-actions Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

✅ 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. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. service/ecs Issues and PRs that pertain to the ecs service. size/M Managed by automation to categorize the size of a PR. labels Jul 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Addresses a defect in current functionality. needs-triage Waiting for first response or review from a maintainer. service/ecs Issues and PRs that pertain to the ecs service. size/M Managed by automation to categorize the size of a PR. 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.

1 participant