Closed Razique closed 1 year ago
@Razique thanks for reporting and digging into the code.
Are you willing to provide a PR that fixes the issue?
Yup! I might need to update my workstation, haven't pushed changes in a while. I'll try to get to that soon.
Summary
Hi, I have noticed that when using the
community.aws.s3_lifecycle
module, AWS S3 complains that values passed for thetransition_days
of a life cycle transition are of string type instead of integer:This is what I have for my transition rule:
With
expiration_days
having a value of 30 andtransition_days
having a value of 15.Looking at the code, I suspect that passing the type instructs Ansible to perform an internal conversion:
The conversion isn't performed for parameters in transtions, because this is a list of dicts:
When the rule is being built via the
build_rule
function, the value is retrieved "as is", which can be a string if the value has been templated by Jinja2.I suggest to force the cast to integer via the following change. This way, irrespective of the type being "rendered" (either native int or str from Jinja2 templating), we always send the correct type:
I could be missing something, but in my test, forcing the conversion solved the issue.
Issue Type
Bug Report
Component Name
s3_lifecycle
Ansible Version
Collection Versions
AWS SDK versions
Configuration
OS / Environment
Fedora release 34 (Thirty Four)
Steps to Reproduce
Expected Results
I expect the module to treat my input value as integer instead of string
Actual Results
Code of Conduct