Ensure predictable ordering for the __resolved__ field so tests are reliable
MODIFY
checkov/terraform/parser.py
checkov/terraform/parser.py
@@ -541,6 +541,7 @@ class Parser:
del self.out_definitions[key]
if new_key not in resolved_loc_list:
resolved_loc_list.append(new_key)
+ resolved_loc_list.sort() # For testing, need predictable ordering
deep_merge.merge(all_module_definitions, module_definitions)
except Exception as e:

MODIFY
tests/terraform/parser/resources/parser_scenarios/account_dirs_and_modules/expected.json
tests/terraform/parser/resources/parser_scenarios/account_dirs_and_modules/expected.json
"ENGINE_VERSION": ["11"],
"ENCRYPTED": [true],
"__resolved__": [
- "modules/db/variables.tf[envs/myaccount/us-east-1/main.tf#0]",
- "modules/db/db.tf[envs/myaccount/us-east-1/main.tf#0]"
+ "modules/db/db.tf[envs/myaccount/us-east-1/main.tf#0]",
+ "modules/db/variables.tf[envs/myaccount/us-east-1/main.tf#0]"
]
}
}
"ENGINE_VERSION": ["11"],
"ENCRYPTED": [true],
"__resolved__": [
- "modules/db/variables.tf[envs/myotheraccount/us-east-1/main.tf#0]",
- "modules/db/db.tf[envs/myotheraccount/us-east-1/main.tf#0]"
+ "modules/db/db.tf[envs/myotheraccount/us-east-1/main.tf#0]",
+ "modules/db/variables.tf[envs/myotheraccount/us-east-1/main.tf#0]"
]
}
}

Ensure predictable ordering for the __resolved__ field so tests are reliable