Skip to content

Commit

Permalink
sns_topic boto3 port (ansible#39292)
Browse files Browse the repository at this point in the history
* Port sns_topic to boto3 and add tests
  • Loading branch information
willthames authored and s-hertel committed Aug 24, 2018
1 parent a78cc15 commit 60e3af4
Show file tree
Hide file tree
Showing 13 changed files with 678 additions and 156 deletions.
3 changes: 3 additions & 0 deletions changelogs/fragments/sns_topic_boto3_port.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
minor_changes:
- sns_topic - Port sns_topic module to boto3 and add an integration test suite.
8 changes: 6 additions & 2 deletions hacking/aws_config/testing_policies/compute-policy.json
Original file line number Diff line number Diff line change
Expand Up @@ -246,9 +246,13 @@
"Action": [
"SNS:CreateTopic",
"SNS:DeleteTopic",
"SNS:ListTopics",
"SNS:GetTopicAttributes",
"SNS:ListSubscriptionsByTopic"
"SNS:ListSubscriptions",
"SNS:ListSubscriptionsByTopic",
"SNS:ListTopics",
"SNS:SetTopicAttributes",
"SNS:Subscribe",
"SNS:Unsubscribe"
],
"Resource": [
"*"
Expand Down
3 changes: 3 additions & 0 deletions hacking/aws_config/testing_policies/security-policy.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@
"Statement": [
{
"Action": [
"iam:GetInstanceProfile",
"iam:GetPolicy",
"iam:GetPolicyVersion",
"iam:GetRole",
"iam:GetRolePolicy",
"iam:ListAttachedRolePolicies",
"iam:ListGroups",
"iam:ListInstanceProfiles",
"iam:ListInstanceProfilesForRole",
"iam:ListPolicies",
"iam:ListRoles",
Expand Down
3 changes: 3 additions & 0 deletions lib/ansible/module_utils/ec2.py
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,9 @@ def _hashable_policy(policy, policy_list):
tupleified = tuple(tupleified)
policy_list.append(tupleified)
elif isinstance(policy, string_types) or isinstance(policy, binary_type):
# convert root account ARNs to just account IDs
if policy.startswith('arn:aws:iam::') and policy.endswith(':root'):
policy = policy.split(':')[4]
return [(to_text(policy))]
elif isinstance(policy, dict):
sorted_keys = list(policy.keys())
Expand Down
Loading

0 comments on commit 60e3af4

Please sign in to comment.