Closed tkintscher closed 2 years ago
As always, one realizes after hitting the Submit button...
The bucket name must be globally unique. If HeadBucket returns '403', it's either due to insufficient permissions for the IAM user, or because the bucket name is already taken by someone else.
Summary
I am trying to create an S3 bucket on AWS, if it does not exist yet.
This is my task:
It fails if the bucket does not exist yet (according to the docs, a bucket should be created in this case). If the bucket already exists, the task completes successfully.
I suspect that it is due to this change: https://github.com/ansible-collections/amazon.aws/pull/357
For the case of a non-existent bucket, the ListBucket command returns an empty list. The HeadBucket command returns 403 in this case, but the code checks for 404. (Note: I gave my IAM user full admin rights, which include the list-bucket permissions necessary to run HeadBucket).
Would someone be able to confirm that the new code indeed works to create buckets that did not exist before?
Issue Type
Bug Report
Component Name
s3_bucket
Ansible Version
Collection Versions
AWS SDK versions
Configuration
OS / Environment
MacOS 12.2.1, ansible installed using brew
Steps to Reproduce
Expected Results
I expected the task to complete ok.
It works, if the bucket already exists. If fails, if the bucket does not exist yet, although the documentation states that a new bucket should be created.
Actual Results
Code of Conduct