CKV_GCP_27 - BaseResourceValueCheck class implementation
-from checkov.common.models.enums import CheckResult, CheckCategories
-from checkov.terraform.checks.resource.base_resource_check import BaseResourceCheck
+from checkov.common.models.enums import CheckCategories
+from checkov.terraform.checks.resource.base_resource_value_check import BaseResourceValueCheck
-class GoogleProjectDefaultNetwork(BaseResourceCheck):
+class GoogleProjectDefaultNetwork(BaseResourceValueCheck):
def __init__(self):
name = "Ensure that the default network does not exist in a project"
id = "CKV_GCP_27"
@@ -10,16 +10,16 @@ class GoogleProjectDefaultNetwork(BaseResourceCheck):
categories = [CheckCategories.NETWORKING]
super().__init__(name=name, id=id, categories=categories, supported_resources=supported_resources)
- def scan_resource_conf(self, conf):
+ def get_inspected_key(self):
"""
https://www.terraform.io/docs/providers/google/r/google_project.html
:param conf: google_project configuration
:return: <CheckResult>
"""
- if 'auto_create_network' in conf.keys():
- if not conf['auto_create_network'][0]:
- return CheckResult.PASSED
- return CheckResult.FAILED
+ return 'auto_create_network/[0]'
+
+ def get_expected_value(self):
+ return False
check = GoogleProjectDefaultNetwork()
