Skip to content

Commit

Permalink
fix some minor issue
Browse files Browse the repository at this point in the history
  • Loading branch information
abikouo committed Sep 15, 2023
1 parent 10f88ea commit a788868
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion plugins/modules/iam_role_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ def normalize_profile(profile):

def normalize_role(role):
new_role = camel_dict_to_snake_dict(role, ignore_list=["tags", "AssumeRolePolicyDocument"])
new_role["assume_role_policy_document"] = new_role.pop("AssumeRolePolicyDocument", {})
new_role["assume_role_policy_document"] = role.get("AssumeRolePolicyDocument", {})
new_role["assume_role_policy_document_raw"] = new_role["assume_role_policy_document"]
if role.get("InstanceProfiles"):
role["instance_profiles"] = [normalize_profile(profile) for profile in role.get("InstanceProfiles")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@
- 'iam_role.iam_role.arn.endswith("role/" + test_role )'
- '"assume_role_policy_document" in iam_role.iam_role'
- '"assume_role_policy_document_raw" in iam_role.iam_role'
- iam_role.iam_role.assume_role_policy_document == assume_deny_policy
- iam_role.iam_role.assume_role_policy_document_raw == assume_deny_policy
- iam_role.iam_role.attached_policies | length == 0
- iam_role.iam_role.max_session_duration == 3600
Expand Down Expand Up @@ -152,6 +153,7 @@
- '"assume_role_policy_document_raw" in role_info.iam_roles[0]'
- '"create_date" in role_info.iam_roles[0]'
- '"description" not in role_info.iam_roles[0]'
- role_info.iam_roles[0].assume_role_policy_document == assume_deny_policy
- role_info.iam_roles[0].assume_role_policy_document_raw == assume_deny_policy
- role_info.iam_roles[0].inline_policies | length == 0
- role_info.iam_roles[0].instance_profiles | length == 0
Expand Down Expand Up @@ -212,6 +214,7 @@
- 'iam_role.iam_role.arn.endswith("role" + test_path + test_role )'
# Would be nice to test the contents...
- '"assume_role_policy_document" in iam_role.iam_role'
- '"assume_role_policy_document_raw" in iam_role.iam_role'
- iam_role.iam_role.attached_policies | length == 0
- iam_role.iam_role.max_session_duration == 3600
- iam_role.iam_role.path == '{{ test_path }}'
Expand Down Expand Up @@ -253,6 +256,7 @@
- 'role_info.iam_roles[0].arn.startswith("arn")'
- 'role_info.iam_roles[0].arn.endswith("role" + test_path + test_role )'
- '"assume_role_policy_document" in role_info.iam_roles[0]'
- '"assume_role_policy_document_raw" in role_info.iam_roles[0]'
- '"create_date" in role_info.iam_roles[0]'
- '"description" not in role_info.iam_roles[0]'
- role_info.iam_roles[0].inline_policies | length == 0
Expand Down Expand Up @@ -280,6 +284,7 @@
- 'role_info.iam_roles[0].arn.startswith("arn")'
- 'role_info.iam_roles[0].arn.endswith("role" + test_path + test_role )'
- '"assume_role_policy_document" in role_info.iam_roles[0]'
- '"assume_role_policy_document_raw" in role_info.iam_roles[0]'
- '"create_date" in role_info.iam_roles[0]'
- '"description" not in role_info.iam_roles[0]'
- role_info.iam_roles[0].inline_policies | length == 0
Expand Down Expand Up @@ -347,6 +352,7 @@
- 'iam_role.iam_role.arn.endswith("role/" + test_role )'
# Would be nice to test the contents...
- '"assume_role_policy_document" in iam_role.iam_role'
- '"assume_role_policy_document_raw" in iam_role.iam_role'
- iam_role.iam_role.attached_policies | length == 0
- iam_role.iam_role.max_session_duration == 3600
- iam_role.iam_role.path == '/'
Expand Down Expand Up @@ -388,6 +394,7 @@
- 'role_info.iam_roles[0].arn.startswith("arn")'
- 'role_info.iam_roles[0].arn.endswith("role/" + test_role )'
- '"assume_role_policy_document" in role_info.iam_roles[0]'
- '"assume_role_policy_document_raw" in role_info.iam_roles[0]'
- '"create_date" in role_info.iam_roles[0]'
- '"description" not in role_info.iam_roles[0]'
- role_info.iam_roles[0].inline_policies | length == 0
Expand Down

0 comments on commit a788868

Please sign in to comment.