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

[PR #2267/db552aa1 backport][stable-8] s3_bucket - fix MethodNotAllowed in regions that don't support transfer acceleration #2269

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions changelogs/fragments/2266-acceleration-eu_north_1.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
bugfixes:
- s3_bucket - fixes ``MethodNotAllowed`` exceptions caused by fetching transfer acceleration state in regions that don't support it (https://github.com/ansible-collections/amazon.aws/issues/2266).
8 changes: 5 additions & 3 deletions plugins/modules/s3_bucket.py
Original file line number Diff line number Diff line change
Expand Up @@ -972,9 +972,11 @@ def handle_bucket_accelerate(s3_client, module: AnsibleAWSModule, name: str) ->
except is_boto3_error_code(["NotImplemented", "XNotImplemented"]) as e:
if accelerate_enabled is not None:
module.fail_json_aws(e, msg="Fetching bucket transfer acceleration state is not supported")
except is_boto3_error_code("UnsupportedArgument") as e: # pylint: disable=duplicate-except
# -- Transfer Acceleration is not available in AWS GovCloud (US).
# -- https://docs.aws.amazon.com/govcloud-us/latest/UserGuide/govcloud-s3.html#govcloud-S3-diffs
except is_boto3_error_code(["UnsupportedArgument", "MethodNotAllowed"]) as e: # pylint: disable=duplicate-except
# - Transfer Acceleration is not available in AWS GovCloud (US) and throws UnsupportedArgument.
# https://docs.aws.amazon.com/govcloud-us/latest/UserGuide/govcloud-s3.html#govcloud-S3-diffs
# - Transfer Acceleration is not available in some AWS regions and throws MethodNotAllowed
# https://docs.aws.amazon.com/AmazonS3/latest/userguide/transfer-acceleration.html
module.warn("Tranfer acceleration is not available in S3 bucket region.")
accelerate_enabled_result = False
except is_boto3_error_code("AccessDenied") as e: # pylint: disable=duplicate-except
Expand Down
Loading