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): default value for CKV_AZURE_5 #4237

Merged
merged 1 commit into from
Jan 16, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
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