diff --git a/plugins/module_utils/gcp_utils.py b/plugins/module_utils/gcp_utils.py index 5bc4815..3580038 100644 --- a/plugins/module_utils/gcp_utils.py +++ b/plugins/module_utils/gcp_utils.py @@ -284,9 +284,15 @@ class GcpRequest(object): list2.sort() for index in range(len(list1)): value1 = list1[index] - if index < len(list2): - value2 = list2[index] - difference.append(self._compare_value(value1, value2)) + # If items are dicts or arrays, we're assuming the next value + # is the correct one. + if isinstance(value1, dict) or isinstance(value1, list): + if index < len(list2): + value2 = list2[index] + difference.append(self._compare_value(value1, value2)) + else: + if value1 not in list2: + difference.append(value1) difference2 = [] for value in difference: diff --git a/test/units/module_utils/gcp/test_gcp_utils.py b/test/units/module_utils/gcp/test_gcp_utils.py index c6c6958..707fcb1 100644 --- a/test/units/module_utils/gcp/test_gcp_utils.py +++ b/test/units/module_utils/gcp/test_gcp_utils.py @@ -149,9 +149,6 @@ class GCPRequestDifferenceTestCase(unittest.TestCase): 'test': 'value', 'foo': 'bar' }, - { - 'different': 'dict' - } ] } value2 = {