ansible-collections / ansible-collections/amazon.aws

s3_bucket always reports changed=true

Open
#2,139 0 comments 0 reactions 0 assignees View on GitHub
needs_verified
Dominant language
Python
Stars
392
Forks
401
Avg merge
6d 10h
Merged PRs (30d)
9

Description

### Summary

`amazon.aws.s3_bucket` always reports `changed=true` even when the bucket to create already exists.
This is with Ceph S3 in case that matters.

Looking at the issues this same problem has been reported in several modules. It might be a good idea to fix all the modules instead of one by one.

### Issue Type

Bug Report

### Component Name

s3_bucket

### Ansible Version

```console (paste below)
$ ansible --version
ansible [core 2.16.7]
config file = /etc/ansible/ansible.cfg
configured module search path = ['/home/ansible/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /home/ansible/lib64/python3.11/site-packages/ansible
ansible collection location = /home/ansible/.ansible/collections:/usr/share/ansible/collections
executable location = /home/ansible/bin/ansible
python version = 3.11.7 (main, Jan 22 2024, 00:00:00) [GCC 11.4.1 20231218 (Red Hat 11.4.1-3)] (/home/ansible/bin/python3.11)
jinja version = 3.1.2
libyaml = True
```

### Collection Versions

```console (paste below)
$ ansible-galaxy collection list
Collection Version
---------------------------------------- -------
amazon.aws 8.0.1
```

### AWS SDK versions

```console (paste below)
$ pip show boto boto3 botocore
Name: boto3
Version: 1.34.126
Summary: The AWS SDK for Python
Home-page: https://github.com/boto/boto3
Author: Amazon Web Services
Author-email:
License: Apache License 2.0
Location: /home/ansible/lib64/python3.11/site-packages
Requires: botocore, jmespath, s3transfer
Required-by:
---
Name: botocore
Version: 1.34.126
Summary: Low-level, data-driven core of boto 3.
Home-page: https://github.com/boto/botocore
Author: Amazon Web Services
Author-email:
License: Apache License 2.0
Location: /home/ansible/lib64/python3.11/site-packages
Requires: jmespath, python-dateutil, urllib3
Required-by: boto3, s3transfer
```

### Configuration

```console (paste below)
$ ansible-config dump --only-changed
not relevant?
```

### OS / Environment

EL9

### Steps to Reproduce

```yaml (paste below)
- name: Create bucket
amazon.aws.s3_bucket:
access_key: "{{ key }}"
acl: private
ceph: true
encryption: none
endpoint_url: "https://ceph.s3.endpoint"
name: bucketname
secret_key: "{{ secretkey }}"
validate_certs: false
```

### Expected Results

The module should report `changed=false` when bucket already exists.

### Actual Results

```console (paste below)
2024-06-17 13:04:09,278 p=113310 u=ansible n=ansible | changed: [host1 -> localhost] => (item=bucketname) => changed=true
acl: private
encryption: null
name: bucketname
object_lock_enabled: false
object_ownership: {}
policy: null
public_access_block: {}
requester_pays: null
tags: {}
versioning:
MfaDelete: Disabled
Versioning: Disabled
```

### Code of Conduct

- [X] I agree to follow the Ansible Code of Conduct

Contributor guide

Open the contributing guide

Research direction

Start with the amazon.aws.s3_bucket module entry point and reproduce the provided playbook against an existing Ceph S3 bucket. Compare the module's changed result with the expected idempotent behavior; done means an existing bucket reports changed=false.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, python
Domain
cloud
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.