prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  ERROR:checkov.terraform.checks.resource.gcp.CloudStorageSelfLogging:Failed to run check: Bucket should not log to itself for configuration
  **Describe the bug**
  Error during check with rule CKV_GCP_63 (not clearly identify)
  
  Here is the result of my terraform plan for my GCS resource using [terraform google storage module](https://github.com/terraform-google-modules/terraform-google-cloud-storage)
  ```
  resource "google_storage_bucket" "buckets" {
    bucket_policy_only          = (known after apply)
        force_destroy               = false
        id                          = (known after apply)
        labels                      = {
            "name" = "xxxxxxxx-bucket"
        }
        location                    = "EU"
        name                        = "xxxxxxxx-bucket"
        project                     = "xxxxxxxx-project"
        self_link                   = (known after apply)
        storage_class               = "STANDARD"
        uniform_bucket_level_access = true
        url                         = (known after apply)
        versioning {
            enabled = true
        }
    }
  ```
  
  ```
  ERROR:checkov.terraform.checks.resource.gcp.CloudStorageSelfLogging:Failed to run check: Bucket should not log to itself for configuration
  [[]], 'default_event_based_hold': [None], 'encryption': [[]], 'force_destroy': [False], 'labels': [{'name': ['xxxxxxxx-bucket'], 'start_line': [158], 'end_line': [160]}], 'lifecycle_rule': [[]], 'location': ['EU'], 'logging': [[]], 'name': ['xxxxxxxx-bucket'], 'project': ['xxxxxxxx-project'], 'requester_pays': [None], 'retention_policy': [[]], 'storage_class': ['STANDARD'], 'uniform_bucket_level_access': [True], 'versioning': [{'enabled': [True], 'start_line': [171], 'end_line': [173]}], 'website': [[]], 'start_line': [153], 'end_line': [176]} at file: /checkov.tfplan.json
  Traceback (most recent call last):
    File "/usr/local/bin/checkov", line 5, in <module>
      run()
    File "/usr/local/lib/python3.8/site-packages/checkov/main.py", line 96, in run
      scan_reports = runner_registry.run(external_checks_dir=external_checks_dir, files=args.file,
    File "/usr/local/lib/python3.8/site-packages/checkov/common/runners/runner_registry.py", line 34, in run
      scan_report = runner.run(root_folder, external_checks_dir=external_checks_dir, files=files,
    File "/usr/local/lib/python3.8/site-packages/checkov/terraform/plan_runner.py", line 65, in run
      self.check_tf_definition(report, runner_filter)
    File "/usr/local/lib/python3.8/site-packages/checkov/terraform/plan_runner.py", line 79, in check_tf_definition
      self.run_block(definition[block_type], full_file_path, report, scanned_file,
    File "/usr/local/lib/python3.8/site-packages/checkov/terraform/plan_runner.py", line 95, in run_block
      results = registry.scan(scanned_file, entity, [], runner_filter)
    File "/usr/local/lib/python3.8/site-packages/checkov/common/checks/base_check_registry.py", line 109, in scan
      result = self.run_check(check, entity_configuration, entity_name, entity_type, scanned_file, skip_info)
    File "/usr/local/lib/python3.8/site-packages/checkov/common/checks/base_check_registry.py", line 115, in run_check
      result = check.run(scanned_file=scanned_file, entity_configuration=entity_configuration,
    File "/usr/local/lib/python3.8/site-packages/checkov/common/checks/base_check.py", line 62, in run
      raise e
    File "/usr/local/lib/python3.8/site-packages/checkov/common/checks/base_check.py", line 42, in run
      check_result['result'] = self.scan_entity_conf(entity_configuration, entity_type)
    File "/usr/local/lib/python3.8/site-packages/checkov/terraform/checks/resource/base_resource_check.py", line 17, in scan_entity_conf
      return self.scan_resource_conf(conf, entity_type)
    File "/usr/local/lib/python3.8/site-packages/checkov/terraform/checks/resource/base_resource_check.py", line 33, in wrapper
      return wrapped(self, conf)
    File "/usr/local/lib/python3.8/site-packages/checkov/terraform/checks/resource/gcp/CloudStorageSelfLogging.py", line 17, in scan_resource_conf
      if conf['logging'][0]['log_bucket']:
  TypeError: list indices must be integers or slices, not str
  ```
  
  **To Reproduce**
  Steps to reproduce the behavior:
  1. Using [terraform GCS module](https://github.com/terraform-google-modules/terraform-google-cloud-storage) in your terraform
  2. Run checkov scan
  3. See error
  
  **Informations**
   - Checkov Version 1.0.799 (from docker image)
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `checkov/terraform/checks/resource/gcp/CloudStorageLogging.py`
  Content:
  ```
  1 from checkov.common.models.enums import CheckResult, CheckCategories
  2 from checkov.terraform.checks.resource.base_resource_check import BaseResourceCheck
  3 
  4 
  5 class CloudStorageLogging(BaseResourceCheck):
  6     def __init__(self):
  7         name = "Bucket should log access"
  8         id = "CKV_GCP_62"
  9         supported_resources = ['google_storage_bucket']
  10         categories = [CheckCategories.LOGGING]
  11         super().__init__(name=name, id=id, categories=categories, supported_resources=supported_resources)
  12 
  13     def scan_resource_conf(self, conf):
  14         #check fot logging
  15         if 'logging' in conf.keys():
  16             if conf['logging'][0]['log_bucket']:
  17                 log_bucket_name = conf['logging'][0]['log_bucket']
  18                 if log_bucket_name != None:
  19                     return CheckResult.PASSED
  20                 else:
  21                    return CheckResult.FAILED
  22             else:
  23                 return CheckResult.FAILED
  24             return CheckResult.FAILED
  25         else:
  26             return CheckResult.FAILED
  27         return CheckResult.FAILED
  28 
  29 check = CloudStorageLogging()
  30
  ```
  
  Path: `checkov/terraform/checks/resource/gcp/CloudStorageSelfLogging.py`
  Content:
  ```
  1 from checkov.common.models.enums import CheckResult, CheckCategories
  2 from checkov.terraform.checks.resource.base_resource_check import BaseResourceCheck
  3 
  4 
  5 class CloudStorageSelfLogging(BaseResourceCheck):
  6     def __init__(self):
  7         name = "Bucket should not log to itself"
  8         id = "CKV_GCP_63"
  9         supported_resources = ['google_storage_bucket']
  10         categories = [CheckCategories.LOGGING]
  11         super().__init__(name=name, id=id, categories=categories, supported_resources=supported_resources)
  12 
  13     def scan_resource_conf(self, conf):
  14         bucket_name = conf['name']
  15         #check fot logging
  16         if 'logging' in conf.keys():
  17             if conf['logging'][0]['log_bucket']:
  18                 log_bucket_name = conf['logging'][0]['log_bucket']
  19                 if log_bucket_name != bucket_name:
  20                     return CheckResult.PASSED
  21                 else:
  22                    return CheckResult.FAILED
  23             else:
  24                 return CheckResult.FAILED
  25             return CheckResult.FAILED
  26         return CheckResult.UNKNOWN
  27 
  28 check = CloudStorageSelfLogging()
  29
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/checkov/terraform/checks/resource/gcp/CloudStorageLogging.py b/checkov/terraform/checks/resource/gcp/CloudStorageLogging.py
  --- a/checkov/terraform/checks/resource/gcp/CloudStorageLogging.py
  +++ b/checkov/terraform/checks/resource/gcp/CloudStorageLogging.py
  @@ -11,9 +11,9 @@
           super().__init__(name=name, id=id, categories=categories, supported_resources=supported_resources)
   
       def scan_resource_conf(self, conf):
  -        #check fot logging
  -        if 'logging' in conf.keys():
  -            if conf['logging'][0]['log_bucket']:
  +        #check for logging
  +        if 'logging' in conf:
  +            if conf['logging'][0]:
                   log_bucket_name = conf['logging'][0]['log_bucket']
                   if log_bucket_name != None:
                       return CheckResult.PASSED
  diff --git a/checkov/terraform/checks/resource/gcp/CloudStorageSelfLogging.py b/checkov/terraform/checks/resource/gcp/CloudStorageSelfLogging.py
  --- a/checkov/terraform/checks/resource/gcp/CloudStorageSelfLogging.py
  +++ b/checkov/terraform/checks/resource/gcp/CloudStorageSelfLogging.py
  @@ -12,9 +12,9 @@
   
       def scan_resource_conf(self, conf):
           bucket_name = conf['name']
  -        #check fot logging
  -        if 'logging' in conf.keys():
  -            if conf['logging'][0]['log_bucket']:
  +        #check for logging
  +        if 'logging' in conf:
  +            if conf['logging'][0]:
                   log_bucket_name = conf['logging'][0]['log_bucket']
                   if log_bucket_name != bucket_name:
                       return CheckResult.PASSED
  
verification_info: {"golden_diff": "diff --git a/checkov/terraform/checks/resource/gcp/CloudStorageLogging.py b/checkov/terraform/checks/resource/gcp/CloudStorageLogging.py\n--- a/checkov/terraform/checks/resource/gcp/CloudStorageLogging.py\n+++ b/checkov/terraform/checks/resource/gcp/CloudStorageLogging.py\n@@ -11,9 +11,9 @@\n         super().__init__(name=name, id=id, categories=categories, supported_resources=supported_resources)\n \n     def scan_resource_conf(self, conf):\n-        #check fot logging\n-        if 'logging' in conf.keys():\n-            if conf['logging'][0]['log_bucket']:\n+        #check for logging\n+        if 'logging' in conf:\n+            if conf['logging'][0]:\n                 log_bucket_name = conf['logging'][0]['log_bucket']\n                 if log_bucket_name != None:\n                     return CheckResult.PASSED\ndiff --git a/checkov/terraform/checks/resource/gcp/CloudStorageSelfLogging.py b/checkov/terraform/checks/resource/gcp/CloudStorageSelfLogging.py\n--- a/checkov/terraform/checks/resource/gcp/CloudStorageSelfLogging.py\n+++ b/checkov/terraform/checks/resource/gcp/CloudStorageSelfLogging.py\n@@ -12,9 +12,9 @@\n \n     def scan_resource_conf(self, conf):\n         bucket_name = conf['name']\n-        #check fot logging\n-        if 'logging' in conf.keys():\n-            if conf['logging'][0]['log_bucket']:\n+        #check for logging\n+        if 'logging' in conf:\n+            if conf['logging'][0]:\n                 log_bucket_name = conf['logging'][0]['log_bucket']\n                 if log_bucket_name != bucket_name:\n                     return CheckResult.PASSED\n", "issue": "ERROR:checkov.terraform.checks.resource.gcp.CloudStorageSelfLogging:Failed to run check: Bucket should not log to itself for configuration\n**Describe the bug**\r\nError during check with rule CKV_GCP_63 (not clearly identify)\r\n\r\nHere is the result of my terraform plan for my GCS resource using [terraform google storage module](https://github.com/terraform-google-modules/terraform-google-cloud-storage)\r\n```\r\nresource \"google_storage_bucket\" \"buckets\" {\r\n  bucket_policy_only          = (known after apply)\r\n      force_destroy               = false\r\n      id                          = (known after apply)\r\n      labels                      = {\r\n          \"name\" = \"xxxxxxxx-bucket\"\r\n      }\r\n      location                    = \"EU\"\r\n      name                        = \"xxxxxxxx-bucket\"\r\n      project                     = \"xxxxxxxx-project\"\r\n      self_link                   = (known after apply)\r\n      storage_class               = \"STANDARD\"\r\n      uniform_bucket_level_access = true\r\n      url                         = (known after apply)\r\n      versioning {\r\n          enabled = true\r\n      }\r\n  }\r\n```\r\n\r\n```\r\nERROR:checkov.terraform.checks.resource.gcp.CloudStorageSelfLogging:Failed to run check: Bucket should not log to itself for configuration\r\n[[]], 'default_event_based_hold': [None], 'encryption': [[]], 'force_destroy': [False], 'labels': [{'name': ['xxxxxxxx-bucket'], 'start_line': [158], 'end_line': [160]}], 'lifecycle_rule': [[]], 'location': ['EU'], 'logging': [[]], 'name': ['xxxxxxxx-bucket'], 'project': ['xxxxxxxx-project'], 'requester_pays': [None], 'retention_policy': [[]], 'storage_class': ['STANDARD'], 'uniform_bucket_level_access': [True], 'versioning': [{'enabled': [True], 'start_line': [171], 'end_line': [173]}], 'website': [[]], 'start_line': [153], 'end_line': [176]} at file: /checkov.tfplan.json\r\nTraceback (most recent call last):\r\n  File \"/usr/local/bin/checkov\", line 5, in <module>\r\n    run()\r\n  File \"/usr/local/lib/python3.8/site-packages/checkov/main.py\", line 96, in run\r\n    scan_reports = runner_registry.run(external_checks_dir=external_checks_dir, files=args.file,\r\n  File \"/usr/local/lib/python3.8/site-packages/checkov/common/runners/runner_registry.py\", line 34, in run\r\n    scan_report = runner.run(root_folder, external_checks_dir=external_checks_dir, files=files,\r\n  File \"/usr/local/lib/python3.8/site-packages/checkov/terraform/plan_runner.py\", line 65, in run\r\n    self.check_tf_definition(report, runner_filter)\r\n  File \"/usr/local/lib/python3.8/site-packages/checkov/terraform/plan_runner.py\", line 79, in check_tf_definition\r\n    self.run_block(definition[block_type], full_file_path, report, scanned_file,\r\n  File \"/usr/local/lib/python3.8/site-packages/checkov/terraform/plan_runner.py\", line 95, in run_block\r\n    results = registry.scan(scanned_file, entity, [], runner_filter)\r\n  File \"/usr/local/lib/python3.8/site-packages/checkov/common/checks/base_check_registry.py\", line 109, in scan\r\n    result = self.run_check(check, entity_configuration, entity_name, entity_type, scanned_file, skip_info)\r\n  File \"/usr/local/lib/python3.8/site-packages/checkov/common/checks/base_check_registry.py\", line 115, in run_check\r\n    result = check.run(scanned_file=scanned_file, entity_configuration=entity_configuration,\r\n  File \"/usr/local/lib/python3.8/site-packages/checkov/common/checks/base_check.py\", line 62, in run\r\n    raise e\r\n  File \"/usr/local/lib/python3.8/site-packages/checkov/common/checks/base_check.py\", line 42, in run\r\n    check_result['result'] = self.scan_entity_conf(entity_configuration, entity_type)\r\n  File \"/usr/local/lib/python3.8/site-packages/checkov/terraform/checks/resource/base_resource_check.py\", line 17, in scan_entity_conf\r\n    return self.scan_resource_conf(conf, entity_type)\r\n  File \"/usr/local/lib/python3.8/site-packages/checkov/terraform/checks/resource/base_resource_check.py\", line 33, in wrapper\r\n    return wrapped(self, conf)\r\n  File \"/usr/local/lib/python3.8/site-packages/checkov/terraform/checks/resource/gcp/CloudStorageSelfLogging.py\", line 17, in scan_resource_conf\r\n    if conf['logging'][0]['log_bucket']:\r\nTypeError: list indices must be integers or slices, not str\r\n```\r\n\r\n**To Reproduce**\r\nSteps to reproduce the behavior:\r\n1. Using [terraform GCS module](https://github.com/terraform-google-modules/terraform-google-cloud-storage) in your terraform\r\n2. Run checkov scan\r\n3. See error\r\n\r\n**Informations**\r\n - Checkov Version 1.0.799 (from docker image)\n", "before_files": [{"content": "from checkov.common.models.enums import CheckResult, CheckCategories\nfrom checkov.terraform.checks.resource.base_resource_check import BaseResourceCheck\n\n\nclass CloudStorageLogging(BaseResourceCheck):\n    def __init__(self):\n        name = \"Bucket should log access\"\n        id = \"CKV_GCP_62\"\n        supported_resources = ['google_storage_bucket']\n        categories = [CheckCategories.LOGGING]\n        super().__init__(name=name, id=id, categories=categories, supported_resources=supported_resources)\n\n    def scan_resource_conf(self, conf):\n        #check fot logging\n        if 'logging' in conf.keys():\n            if conf['logging'][0]['log_bucket']:\n                log_bucket_name = conf['logging'][0]['log_bucket']\n                if log_bucket_name != None:\n                    return CheckResult.PASSED\n                else:\n                   return CheckResult.FAILED\n            else:\n                return CheckResult.FAILED\n            return CheckResult.FAILED\n        else:\n            return CheckResult.FAILED\n        return CheckResult.FAILED\n\ncheck = CloudStorageLogging()\n", "path": "checkov/terraform/checks/resource/gcp/CloudStorageLogging.py"}, {"content": "from checkov.common.models.enums import CheckResult, CheckCategories\nfrom checkov.terraform.checks.resource.base_resource_check import BaseResourceCheck\n\n\nclass CloudStorageSelfLogging(BaseResourceCheck):\n    def __init__(self):\n        name = \"Bucket should not log to itself\"\n        id = \"CKV_GCP_63\"\n        supported_resources = ['google_storage_bucket']\n        categories = [CheckCategories.LOGGING]\n        super().__init__(name=name, id=id, categories=categories, supported_resources=supported_resources)\n\n    def scan_resource_conf(self, conf):\n        bucket_name = conf['name']\n        #check fot logging\n        if 'logging' in conf.keys():\n            if conf['logging'][0]['log_bucket']:\n                log_bucket_name = conf['logging'][0]['log_bucket']\n                if log_bucket_name != bucket_name:\n                    return CheckResult.PASSED\n                else:\n                   return CheckResult.FAILED\n            else:\n                return CheckResult.FAILED\n            return CheckResult.FAILED\n        return CheckResult.UNKNOWN\n\ncheck = CloudStorageSelfLogging()\n", "path": "checkov/terraform/checks/resource/gcp/CloudStorageSelfLogging.py"}], "after_files": [{"content": "from checkov.common.models.enums import CheckResult, CheckCategories\nfrom checkov.terraform.checks.resource.base_resource_check import BaseResourceCheck\n\n\nclass CloudStorageLogging(BaseResourceCheck):\n    def __init__(self):\n        name = \"Bucket should log access\"\n        id = \"CKV_GCP_62\"\n        supported_resources = ['google_storage_bucket']\n        categories = [CheckCategories.LOGGING]\n        super().__init__(name=name, id=id, categories=categories, supported_resources=supported_resources)\n\n    def scan_resource_conf(self, conf):\n        #check for logging\n        if 'logging' in conf:\n            if conf['logging'][0]:\n                log_bucket_name = conf['logging'][0]['log_bucket']\n                if log_bucket_name != None:\n                    return CheckResult.PASSED\n                else:\n                   return CheckResult.FAILED\n            else:\n                return CheckResult.FAILED\n            return CheckResult.FAILED\n        else:\n            return CheckResult.FAILED\n        return CheckResult.FAILED\n\ncheck = CloudStorageLogging()\n", "path": "checkov/terraform/checks/resource/gcp/CloudStorageLogging.py"}, {"content": "from checkov.common.models.enums import CheckResult, CheckCategories\nfrom checkov.terraform.checks.resource.base_resource_check import BaseResourceCheck\n\n\nclass CloudStorageSelfLogging(BaseResourceCheck):\n    def __init__(self):\n        name = \"Bucket should not log to itself\"\n        id = \"CKV_GCP_63\"\n        supported_resources = ['google_storage_bucket']\n        categories = [CheckCategories.LOGGING]\n        super().__init__(name=name, id=id, categories=categories, supported_resources=supported_resources)\n\n    def scan_resource_conf(self, conf):\n        bucket_name = conf['name']\n        #check for logging\n        if 'logging' in conf:\n            if conf['logging'][0]:\n                log_bucket_name = conf['logging'][0]['log_bucket']\n                if log_bucket_name != bucket_name:\n                    return CheckResult.PASSED\n                else:\n                   return CheckResult.FAILED\n            else:\n                return CheckResult.FAILED\n            return CheckResult.FAILED\n        return CheckResult.UNKNOWN\n\ncheck = CloudStorageSelfLogging()\n", "path": "checkov/terraform/checks/resource/gcp/CloudStorageSelfLogging.py"}]}