aws_s3 - wait for the bucket before setting ACLs (#61735)

* Wait for the bucket to become available if possible before setting ACLs
This commit is contained in:
Sloane Hertel 2019-09-04 09:42:28 -04:00 committed by Sam Doran
parent 531e0560cb
commit 91ccb03552
2 changed files with 5 additions and 0 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- aws_s3 - Try to wait for the bucket to exist before setting the access control list.

View file

@ -389,6 +389,9 @@ def create_bucket(module, s3, bucket, location=None):
s3.create_bucket(Bucket=bucket, CreateBucketConfiguration=configuration)
else:
s3.create_bucket(Bucket=bucket)
if module.params.get('permission') and not module.params.get('ignore_nonexistent_bucket'):
# Wait for the bucket to exist before setting ACLs
s3.get_waiter('bucket_exists').wait(Bucket=bucket)
for acl in module.params.get('permission'):
s3.put_bucket_acl(ACL=acl, Bucket=bucket)
except botocore.exceptions.ClientError as e: