Skip to content
This repository has been archived by the owner on Oct 24, 2023. It is now read-only.

Commit

Permalink
change default value
Browse files Browse the repository at this point in the history
  • Loading branch information
YaaraVerner committed Feb 8, 2023
1 parent 7d3b1da commit f28539f
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion checkov/terraform/checks/utils/dependency_path_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
def unify_dependency_path(dependency_path: List[str]) -> str:
if not dependency_path:
return ''
if strtobool(os.getenv('CHECKOV_ENABLE_NESTED_MODULES', 'False')):
if strtobool(os.getenv('CHECKOV_ENABLE_NESTED_MODULES', 'True')):
return dependency_path[-1]
return PATH_SEPARATOR.join(dependency_path)
2 changes: 1 addition & 1 deletion checkov/terraform/graph_builder/graph_components/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def __init__(self, name: str, config: Dict[str, Any], path: str, block_type: Blo
self.module_dependency = ""
self.module_dependency_num = ""
if path:
if strtobool(os.getenv('CHECKOV_ENABLE_NESTED_MODULES', 'False')):
if strtobool(os.getenv('CHECKOV_ENABLE_NESTED_MODULES', 'True')):
self.path = path
else:
self.path, module_dependency, num = remove_module_dependency_in_path(path)
Expand Down
2 changes: 1 addition & 1 deletion checkov/terraform/graph_builder/graph_components/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def __init__(
self.resources_types: Set[str] = set()
self.source_dir = source_dir
self.render_dynamic_blocks_env_var = os.getenv('CHECKOV_RENDER_DYNAMIC_MODULES', 'True')
self.enable_nested_modules = strtobool(os.getenv('CHECKOV_ENABLE_NESTED_MODULES', 'False'))
self.enable_nested_modules = strtobool(os.getenv('CHECKOV_ENABLE_NESTED_MODULES', 'True'))

def add_blocks(
self, block_type: BlockType, blocks: List[Dict[str, Dict[str, Any]]], path: str, source: str
Expand Down
2 changes: 1 addition & 1 deletion checkov/terraform/graph_builder/graph_to_tf_definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ def convert_graph_vertices_to_tf_definitions(
def add_breadcrumbs(vertex: TerraformBlock, breadcrumbs: Dict[str, Dict[str, Any]], relative_block_path: str) -> None:
vertex_breadcrumbs = vertex.breadcrumbs
if vertex_breadcrumbs:
vertex_key = vertex.name if not strtobool(os.getenv('CHECKOV_ENABLE_NESTED_MODULES', 'False')) else vertex.attributes.get(CustomAttributes.TF_RESOURCE_ADDRESS, vertex.name)
vertex_key = vertex.name if not strtobool(os.getenv('CHECKOV_ENABLE_NESTED_MODULES', 'True')) else vertex.attributes.get(CustomAttributes.TF_RESOURCE_ADDRESS, vertex.name)
breadcrumbs.setdefault(relative_block_path, {})[vertex_key] = vertex_breadcrumbs
2 changes: 1 addition & 1 deletion checkov/terraform/graph_builder/local_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,6 @@ def update_list_attribute(
def get_path_with_nested_modules(block: TerraformBlock) -> str:
if not block.module_dependency:
return block.path
if not strtobool(os.getenv('CHECKOV_ENABLE_NESTED_MODULES', 'False')):
if not strtobool(os.getenv('CHECKOV_ENABLE_NESTED_MODULES', 'True')):
return unify_dependency_path([block.module_dependency, block.path])
return get_tf_definition_key_from_module_dependency(block.path, block.module_dependency, block.module_dependency_num)
2 changes: 1 addition & 1 deletion checkov/terraform/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def __init__(self, module_class: type[Module] = Module) -> None:
# Tuple is <file>, <module_index>, <name> (see _load_modules)
self._loaded_modules: Set[Tuple[str, int, str]] = set()
self.external_variables_data = []
self.enable_nested_modules = strtobool(os.getenv('CHECKOV_ENABLE_NESTED_MODULES', 'False'))
self.enable_nested_modules = strtobool(os.getenv('CHECKOV_ENABLE_NESTED_MODULES', 'True'))

def _init(self, directory: str, out_definitions: Optional[Dict],
out_evaluations_context: Dict[str, Dict[str, EvaluationContext]],
Expand Down
2 changes: 1 addition & 1 deletion checkov/terraform/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def __init__(
self.definitions_with_modules: dict[str, dict[str, Any]] = {}
self.referrer_cache: Dict[str, str] = {}
self.non_referred_cache: Set[str] = set()
self.enable_nested_modules = strtobool(os.getenv('CHECKOV_ENABLE_NESTED_MODULES', 'False'))
self.enable_nested_modules = strtobool(os.getenv('CHECKOV_ENABLE_NESTED_MODULES', 'True'))

block_type_registries = { # noqa: CCE003 # a static attribute
'resource': resource_registry,
Expand Down

0 comments on commit f28539f

Please sign in to comment.