terraform-provider-aws icon indicating copy to clipboard operation
terraform-provider-aws copied to clipboard

Add new aws_mwaa_environment property "Worker replacement strategy" (graceful / forced)

Open andreasbolstad opened this issue 5 months ago • 2 comments

Description

AWS has added a new attribute for MWAA environments. Useful to have that available to users of the terraform resource aws_mwaa_environment.

Affected Resource(s) or Data Source(s)

  • aws_mwaa_environment

Potential Terraform Configuration

worker_replacement_strategy = "GRACEFUL"

References

Userguide: https://docs.aws.amazon.com/mwaa/latest/userguide/update-environment.html#worker-replacement-strategy

Go SDK: https://docs.aws.amazon.com/mwaa/latest/API/API_UpdateEnvironment.html#API_UpdateEnvironment_RequestSyntax

Would you like to implement the enhancement?

No

andreasbolstad avatar Jun 03 '25 10:06 andreasbolstad

Community Guidelines

This comment is added to every new Issue 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! :rocket:

Voting for Prioritization

  • Please vote on this Issue by adding a :+1: 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 Issue and do not help prioritize the request.

Volunteering to Work on This Issue

  • If you are interested in working on this issue, please leave a comment.
  • If this would be your first contribution, please review the contribution guide.
  • For new resources and data sources, use skaff to generate scaffolding with comments detailing common expectations.

github-actions[bot] avatar Jun 03 '25 10:06 github-actions[bot]

Require AWS GO SDK v2 Release (2025-05-29)

Note: The WorkerReplacementStrategy parameter appears only in the Update API—not in the Create or Get APIs—indicating that it is related to the update operation itself, rather than the resource state.

tabito-hara avatar Jun 03 '25 14:06 tabito-hara

Any update on this?

rmccarthy-ellevation avatar Jul 14 '25 13:07 rmccarthy-ellevation

Sharing in case anyone finds a workaround helpful since it seems this might be a while. Managed to get this working with a null_resource and the aws cli. It only updates the env once upon initial creation.

resource "null_resource" "graceful_update" {
  triggers = {
    # When these change, a new env got created so re-run this to update it only once on creation
    vpc      = aws_mwaa_environment.mwaa-environment.webserver_vpc_endpoint_service
    database = aws_mwaa_environment.mwaa-environment.database_vpc_endpoint_service
  }
  provisioner "local-exec" {
    command = "chmod +x ./scripts/graceful-update.sh; ./scripts/graceful-update.sh ${var.region} ${aws_mwaa_environment.mwaa-environment.name}"
  }

  depends_on = [aws_mwaa_environment.mwaa-environment]
}

graceful-update.sh

#!/usr/bin/env bash
# Hack until https://github.com/hashicorp/terraform-provider-aws/issues/42842 is done
set -euv -o pipefail

region="$1"
environment="$2"

aws mwaa \
    update-environment \
    --region="$region" \
    --name="$environment" \
    --worker-replacement-strategy='GRACEFUL' 

jmahlik avatar Jul 31 '25 17:07 jmahlik

[!WARNING] This Issue has been closed, meaning that any additional comments are much easier for the maintainers to miss. Please assume that the maintainers will not see them.

Ongoing conversations amongst community members are welcome, however, the issue will be locked after 30 days. Moving conversations to another venue, such as the AWS Provider forum, is recommended. If you have additional concerns, please open a new issue, referencing this one where needed.

github-actions[bot] avatar Aug 22 '25 14:08 github-actions[bot]

This functionality has been released in v6.11.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

github-actions[bot] avatar Aug 28 '25 18:08 github-actions[bot]

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

github-actions[bot] avatar Sep 28 '25 02:09 github-actions[bot]