diff --git a/changelogs/fragments/49676-s3bucket-requester_pays_change_if_condition.yml b/changelogs/fragments/49676-s3bucket-requester_pays_change_if_condition.yml new file mode 100644 index 0000000000..79a1dd1cb2 --- /dev/null +++ b/changelogs/fragments/49676-s3bucket-requester_pays_change_if_condition.yml @@ -0,0 +1,2 @@ +bugfixes: +- replaced if condition requester_pays is None with True or False instead diff --git a/lib/ansible/modules/cloud/amazon/s3_bucket.py b/lib/ansible/modules/cloud/amazon/s3_bucket.py index 91166ea869..07f49cc9e4 100644 --- a/lib/ansible/modules/cloud/amazon/s3_bucket.py +++ b/lib/ansible/modules/cloud/amazon/s3_bucket.py @@ -58,7 +58,7 @@ options: - With Requester Pays buckets, the requester instead of the bucket owner pays the cost of the request and the data download from the bucket. type: bool - default: 'no' + default: False state: description: - Create or remove the s3 bucket @@ -197,7 +197,7 @@ def create_or_update_bucket(s3_client, module, location): if exp.response['Error']['Code'] != 'NotImplemented' or requester_pays is not None: module.fail_json_aws(exp, msg="Failed to get bucket request payment") else: - if requester_pays is not None: + if requester_pays: payer = 'Requester' if requester_pays else 'BucketOwner' if requester_pays_status != payer: put_bucket_request_payment(s3_client, name, payer) @@ -545,7 +545,7 @@ def main(): force=dict(required=False, default='no', type='bool'), policy=dict(required=False, default=None, type='json'), name=dict(required=True, type='str'), - requester_pays=dict(default='no', type='bool'), + requester_pays=dict(default=False, type='bool'), s3_url=dict(aliases=['S3_URL'], type='str'), state=dict(default='present', type='str', choices=['present', 'absent']), tags=dict(required=False, default=None, type='dict'),