Skip to content

Commit

Permalink
check if the dynamic name is one of the resources block
Browse files Browse the repository at this point in the history
  • Loading branch information
lirshindalman committed Oct 1, 2023
1 parent ebb1fca commit cb9864b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion checkov/terraform/parser_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,13 @@ def process_dynamic_values(conf: Dict[str, List[Any]]) -> bool:

for element_name, element_value in dynamic_element.items():
if "content" in element_value:
conf[element_name] = element_value["content"]
if element_name in conf:
if isinstance(conf[element_name], list):
conf[element_name].append(element_value["content"])
else:
conf[element_name] = [conf[element_name], element_value["content"]]
else:
conf[element_name] = element_value["content"]
else:
# this should be the result of a successful dynamic block rendering
# in some cases a whole dict is added, which doesn't have a list around it
Expand Down

0 comments on commit cb9864b

Please sign in to comment.