Skip to content

Commit

Permalink
fix(terraform): default value for CKV_AZURE_5
Browse files Browse the repository at this point in the history
  • Loading branch information
Frederic Barriere committed Jan 11, 2023
1 parent 6f4ca40 commit 2ac7cfb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions checkov/terraform/checks/resource/azure/AKSRbacEnabled.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ def scan_resource_conf(self, conf):
]

for key in self.evaluated_keys:
if dpath.search(conf, key) and dpath.get(conf, key)[0]:
return CheckResult.PASSED
if dpath.search(conf, key):
return CheckResult.PASSED if dpath.get(conf, key)[0] else CheckResult.FAILED

return CheckResult.FAILED
return CheckResult.PASSED


check = AKSRbacEnabled()
4 changes: 2 additions & 2 deletions tests/terraform/checks/resource/azure/test_AKSRbacEnabled.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def test_failure_false_new_syntax(self):
scan_result = check.scan_resource_conf(conf=resource_conf)
self.assertEqual(CheckResult.FAILED, scan_result)

def test_failure_default(self):
def test_success_default(self):
resource_conf = {
"name": ["example-aks1"],
"location": ["${azurerm_resource_group.example.location}"],
Expand All @@ -64,7 +64,7 @@ def test_failure_default(self):
}

scan_result = check.scan_resource_conf(conf=resource_conf)
self.assertEqual(CheckResult.FAILED, scan_result)
self.assertEqual(CheckResult.PASSED, scan_result)

# azurerm < 2.99.0
def test_success(self):
Expand Down

0 comments on commit 2ac7cfb

Please sign in to comment.