-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(terraform_plan): Add PY graph checks for tf plan (#5875)
* add graph checks for tf plan * func * mypy * UT
- Loading branch information
1 parent
85a69e7
commit 06d1bd1
Showing
5 changed files
with
1,851 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
from __future__ import annotations | ||
from typing import Any | ||
from checkov.terraform.checks.resource.base_resource_value_check import BaseResourceValueCheck | ||
from checkov.common.models.enums import CheckCategories, CheckResult | ||
|
||
|
||
class JustForTest(BaseResourceValueCheck): | ||
def __init__(self): | ||
name = "Just for test (Like CKV2_GCP_18)" | ||
id = "CKV_AWS_99999" | ||
supported_resources = ['google_compute_network'] | ||
categories = [CheckCategories.ENCRYPTION] | ||
super().__init__(name=name, id=id, categories=categories, supported_resources=supported_resources) | ||
|
||
def get_inspected_key(self): | ||
return "storage_encrypted" | ||
|
||
def scan_resource_conf(self, conf: dict[str, list[Any]]) -> CheckResult: | ||
result = super().scan_resource_conf(conf=conf) | ||
# For IGraph framework - | ||
resources = self.graph.vs.select(block_type__eq="resource")["attr"] | ||
# For RustworkX Framework - [g[1] for g in self.graph.nodes() if g[1].get('block_type_') == 'resource'] | ||
|
||
# Do something here. | ||
if resources: | ||
return CheckResult.PASSED | ||
return result | ||
|
||
|
||
check = JustForTest() |
Oops, something went wrong.