ionos-cloud/module-ansible

Can't create S3 keys after update to release 6

Closed this issue · 2 comments

Description

Creation of S3 keys doesn't work with any version after 6.0.0 and fails with the error message

The full traceback is:
  File "/tmp/ansible_ionoscloudsdk.ionoscloud.s3key_payload_cu61hol4/ansible_ionoscloudsdk.ionoscloud.s3key_payload.zip/ansible_collections/ionoscloudsdk/ionoscloud/plugins/modules/s3key.py", line 218, in main
  File "/tmp/ansible_ionoscloudsdk.ionoscloud.s3key_payload_cu61hol4/ansible_ionoscloudsdk.ionoscloud.s3key_payload.zip/ansible_collections/ionoscloudsdk/ionoscloud/plugins/modules/s3key.py", line 56, in create_s3key
fatal: [instance]: FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "active": null,
            "api_url": null,
            "key_id": null,
            "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "state": "present",
            "user_id": "e2271128-609d-4576-96ba-a3c737b46d8d",
            "username": "<username>",
            "wait": true,
            "wait_timeout": 600
        }
    }
}

MSG:

failed to set user state: module 'ionoscloud' has no attribute 'UserS3KeysApi'

With version 5.0.9 it still works

Environment

Ansible version:

ansible 2.10.7
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/cosimon/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/cosimon/.local/lib/python3.8/site-packages/ansible
  executable location = /home/cosimon/.local/bin/ansible
  python version = 3.8.10 (default, Nov 26 2021, 20:14:08) [GCC 9.3.0]

Module version: >= 6.0.0
OS: Ubuntu 20.04.4 LTS

Configuration Files

Ansible task that causes the issue

- name: Create an s3key for IONOS DCD
  ionoscloudsdk.ionoscloud.s3key:
    user_id: "{{ user_id }}"

Hello @simoncolincap! Thanks for reaching out!
This error appears because of a mismatch between the Ansible Module and IONOS Cloud Python SDK. When upgrading to a version >= 6.0.0, you have to install a version >=6.0.0 of the Python SDK too.
If you try to update the Python SDK version using

pip install ionoscloud

it should work.

I'm waiting for your feedback, to see if we can close the issue. Thank you!

It works with the updated python sdk, thanks!