Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sns_topic: Loop through defaultHealthyRetryPolicy attributes and cast them as integers #716

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions changelogs/fragments/716-sns-topic-cast-integers.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- sns_topic - loop through defaultHealthyRetryPolicy attributes and cast them as integers to avoid type errors from the AWS API.
6 changes: 6 additions & 0 deletions plugins/modules/sns_topic.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,12 @@ def _set_topic_attrs(self):
if self.delivery_policy and ('DeliveryPolicy' not in topic_attributes or
self._compare_delivery_policies(self.delivery_policy, json.loads(topic_attributes['DeliveryPolicy']))):
changed = True

# Ensure delivery_policy attributes are cast as integers
for setting, value in self.delivery_policy['http']['defaultHealthyRetryPolicy'].items():
if setting != 'backoffFunction': # this is the only item that should be a string
self.delivery_policy['http']['defaultHealthyRetryPolicy'][setting] = int(value)

self.attributes_set.append('delivery_policy')
if not self.check_mode:
try:
Expand Down