Closed gregharvey closed 3 years ago
Forked code can be found here, ahead of a proper PR: https://github.com/codeenigma/ce-provision/pull/288
Specifically, these four lines: https://github.com/codeenigma/ce-provision/pull/288/files#diff-dc75a3db723f90b72bb0286469561ef308b6051ae3825415c45efab1c8c4994cR358
cc @jillr @joelthompson @markuman @nand0p @s-hertel @tremble @wimnat click here for bot help
Summary
It's a curious issue that if you need to store variables for a module in a dict then when you pass them over to the module they will always be a string. (See example below.)
There doesn't seem to be any sane way to pass a true integer to the module in this case. Which leaves the only way around this as having the module itself ensure the values passed are cast as integers before they are sent to the AWS API. Given we know the API is fussy and we haven't seen anything like this with other modules, I'm assuming the "usual" behaviour for these AWS modules is to cast integers as there's no way to guarantee Ansible/jinja will send a true integer to the module. This module should do this too.
We've patched this module locally and it now works for us, I'll provide a PR tomorrow with our working changes.PR provided! #716Issue Type
Bug Report
Component Name
sns_topic
Ansible Version
Collection Versions
AWS SDK versions
Configuration
OS / Environment
Debian Buster
Steps to Reproduce
If my playbook looks like this - note particularly the vars, the SNS vars nested neatly into a dict for readability:
And my role task looks like this in
sns.yml
:There's nothing wrong with that, we're even casting it as an int with jinja to try and be doubly sure, but it will still fail with this:
"msg": "Couldn't set topic delivery policy: An error occurred (InvalidParameter) when calling the SetTopicAttributes operation: Invalid parameter: DeliveryPolicy: http.defaultHealthyRetryPolicy.minDelayTarget type mismatch, expecting integer, received a string"
Expected Results
I expect the integers passed in the
aws_sns
dict to be respected as integers and passed as integers to the AWS API.Actual Results
"msg": "Couldn't set topic delivery policy: An error occurred (InvalidParameter) when calling the SetTopicAttributes operation: Invalid parameter: DeliveryPolicy: http.defaultHealthyRetryPolicy.minDelayTarget type mismatch, expecting integer, received a string"
Code of Conduct