Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(terraform): Fixing some broke flow in dynamic blocks rendering #3879

Merged
merged 3 commits into from
Nov 15, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions checkov/terraform/checks/resource/aws/WAFACLCVE202144228.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ def scan_resource_conf(self, conf: Dict[str, Any]) -> CheckResult:
statement = rule.get("statement")
if statement:
self.evaluated_keys = [f"rule/[{idx_rule}]/statement/[0]/managed_rule_group_statement"]
if not isinstance(statement, list):
return CheckResult.UNKNOWN
managed_group = statement[0].get("managed_rule_group_statement")
if managed_group:
self.evaluated_keys = [f"rule/[{idx_rule}]/statement/[0]/managed_rule_group_statement/[0]/name"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,10 @@ def _process_dynamic_blocks(dynamic_blocks: list[dict[str, Any]] | dict[str, Any
dpath.set(block_conf, dynamic_argument,
dynamic_value[block_name][0][dynamic_value_in_map], separator='.')
else:
dpath.set(block_conf, dynamic_argument, dynamic_value, separator='.')
if isinstance(dynamic_value, dict) and dynamic_argument in dynamic_value:
dpath.set(block_conf, dynamic_argument, dynamic_value[dynamic_argument], separator='.')
else:
dpath.set(block_conf, dynamic_argument, dynamic_value, separator='.')

block_confs.append(block_conf)
rendered_blocks[block_name] = block_confs if len(block_confs) > 1 else block_confs[0]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
variable "http_headers" {
type = list(object({
num = number
values = list
values = string
}))
default = [{
"num": 1,
"protoc": "tcp",
"values": ["10.0.0.1/32"]
"values": "10.0.0.1/32"
},
{
"num": 2,
"protoc": "tcp",
"values": ["10.0.0.2/32"]
"values": "10.0.0.2/32"
}]
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
variable "http_headers" {
type = list(object({
num = number
values = list
values = string
}))
default = [{
"num": 1,
"protoc": "tcp",
"values": ["10.0.0.1/32"]
"values": "10.0.0.1/32"
},
{
"num": 2,
"protoc": "tcp",
"values": ["10.0.0.2/32"]
"values": "10.0.0.2/32"
}]
}

Expand Down