Skip to content

Commit f4566e9

Browse files
Aashiq-Jtsmithv11
andauthored
fix(terraform): CKV2_IBM_1 - ignore case for load balancer of type private_path (#7010)
* fix: ignore case for load balancer of type private_path * Fix and add test --------- Co-authored-by: Taylor <[email protected]> Co-authored-by: Taylor <[email protected]>
1 parent 2a511f1 commit f4566e9

File tree

4 files changed

+21
-9
lines changed

4 files changed

+21
-9
lines changed

checkov/terraform/checks/graph_checks/ibm/IBM_LoadBalancerforVPCisPrivate.yaml

+11-8
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,20 @@ metadata:
22
id: "CKV2_IBM_1"
33
name: "Ensure load balancer for VPC is private (disable public access)"
44
category: "GENERAL_SECURITY"
5-
65
definition:
76
and:
8-
97
- cond_type: "attribute"
108
resource_types: "ibm_is_lb"
119
attribute: "type"
1210
operator: "exists"
13-
14-
- cond_type: "attribute"
15-
resource_types: "ibm_is_lb"
16-
attribute: "type"
17-
operator: "equals_ignore_case"
18-
value: "private"
11+
- or:
12+
- cond_type: "attribute"
13+
resource_types: "ibm_is_lb"
14+
attribute: "type"
15+
operator: "equals_ignore_case"
16+
value: "private"
17+
- cond_type: "attribute"
18+
resource_types: "ibm_is_lb"
19+
attribute: "type"
20+
operator: "equals_ignore_case"
21+
value: "private_path"
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
pass:
22
- "ibm_is_lb.pass"
3+
- "ibm_is_lb.pass_private_path"
34
fail:
45
- "ibm_is_lb.fail"

tests/terraform/graph/checks/resources/IBM_LoadBalancerforVPCisPrivate/main.tf

+8
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,11 @@ resource "ibm_is_lb" "fail" {
1717
subnets = [var.pud-subnet]
1818
profile = "network-fixed"
1919
}
20+
21+
# Case 3: Pass: type = "private"
22+
23+
resource "ibm_is_lb" "pass_private_path" {
24+
name = "pud-load-balancer"
25+
subnets = [var.pud-subnet]
26+
type = "private_path"
27+
}

tests/terraform/graph/checks/test_yaml_policies.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ def test_AzureMSSQLserverConfigPrivEndpt(self):
511511
def test_AzureSynapseWorkspaceVAisEnabled(self):
512512
self.go("AzureSynapseWorkspaceVAisEnabled")
513513

514-
def test_IBM_AppLBforVPCisPrivate(self):
514+
def test_IBM_LoadBalancerforVPCisPrivate(self):
515515
self.go("IBM_LoadBalancerforVPCisPrivate")
516516

517517
def test_IBM_VPCclassicAccessIsDisabled(self):

0 commit comments

Comments
 (0)