CKV_GCP_14 - BaseResourceValueCheck class implementation
-from checkov.terraform.checks.resource.base_resource_check import BaseResourceCheck
-from checkov.common.models.enums import CheckResult, CheckCategories
+from checkov.terraform.checks.resource.base_resource_value_check import BaseResourceValueCheck
+from checkov.common.models.enums import CheckCategories
-class GoogleCloudSqlBackupConfiguration(BaseResourceCheck):
+class GoogleCloudSqlBackupConfiguration(BaseResourceValueCheck):
def __init__(self):
name = "Ensure all Cloud SQL database instance have backup configuration enabled"
id = "CKV_GCP_14"
@@ -10,11 +10,8 @@ class GoogleCloudSqlBackupConfiguration(BaseResourceCheck):
categories = [CheckCategories.NETWORKING]
super().__init__(name=name, id=id, categories=categories, supported_resources=supported_resources)
- def scan_resource_conf(self, conf):
- if 'settings' in conf and 'backup_configuration' in conf['settings'][0]:
- if conf['settings'][0]['backup_configuration'][0]['enabled']:
- return CheckResult.PASSED
- return CheckResult.FAILED
+ def get_inspected_key(self):
+ return 'settings/[0]/backup_configuration/[0]/enabled'
check = GoogleCloudSqlBackupConfiguration()
