Skip to content

Commit

Permalink
fix(terraform): handle unexpected value for enabled_cloudwatch_logs_e…
Browse files Browse the repository at this point in the history
…xports (#3638)

* handle unexpected value for enabled_cloudwatch_logs_exports

* PR comment
  • Loading branch information
PelegLi authored Oct 11, 2022
1 parent c148894 commit d67da44
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions checkov/terraform/checks/resource/aws/DBInstanceLogging.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ def get_inspected_key(self) -> str:
return "enabled_cloudwatch_logs_exports/[0]"

def scan_resource_conf(self, conf: Dict[str, List[Any]]) -> CheckResult:
logs_exports = conf.get('enabled_cloudwatch_logs_exports', [[]])[0]
return CheckResult.PASSED if logs_exports else CheckResult.FAILED
logs_exports = conf.get('enabled_cloudwatch_logs_exports', [[]])
if not logs_exports:
return CheckResult.FAILED
return CheckResult.PASSED if logs_exports[0] else CheckResult.FAILED

def get_expected_value(self) -> Any:
return ANY_VALUE
Expand Down

0 comments on commit d67da44

Please sign in to comment.