ansible-collections / amazon.aws

Ansible Collection for Amazon AWS
GNU General Public License v3.0
310 stars 336 forks source link

s3_bucket always reports changed=true #2139

Open bluikko opened 3 months ago

bluikko commented 3 months ago

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

$ 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

$ ansible-galaxy collection list
Collection                               Version
---------------------------------------- -------
amazon.aws                               8.0.1

AWS SDK versions

$ 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

$ ansible-config dump --only-changed
not relevant?

OS / Environment

EL9

Steps to Reproduce

- 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

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