* Wait for the bucket to become available if possible before setting ACLs
(cherry picked from commit 91ccb03552)
Co-authored-by: Sloane Hertel <shertel@redhat.com>
... | ... |
@@ -389,6 +389,9 @@ def create_bucket(module, s3, bucket, location=None): |
389 | 389 |
s3.create_bucket(Bucket=bucket, CreateBucketConfiguration=configuration) |
390 | 390 |
else: |
391 | 391 |
s3.create_bucket(Bucket=bucket) |
392 |
+ if module.params.get('permission') and not module.params.get('ignore_nonexistent_bucket'): |
|
393 |
+ # Wait for the bucket to exist before setting ACLs |
|
394 |
+ s3.get_waiter('bucket_exists').wait(Bucket=bucket) |
|
392 | 395 |
for acl in module.params.get('permission'): |
393 | 396 |
s3.put_bucket_acl(ACL=acl, Bucket=bucket) |
394 | 397 |
except botocore.exceptions.ClientError as e: |