ERROR:checkov.terraform.checks.resource.gcp.CloudStorageSelfLogging:Failed to run check: Bucket should not log to itself for configuration
See original GitHub issueDescribe 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
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:
- Using terraform GCS module in your terraform
- Run checkov scan
- See error
Informations
- Checkov Version 1.0.799 (from docker image)
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Ensure bucket does not log to itself - Documentation
A check to ensure that the specified logging bucket is not itself. A bucket must not log access to itself, logging requires a...
Read more >google_storage_bucket | Resources | hashicorp/google
google_storage_bucket. Creates a new bucket in Google cloud storage service (GCS). Once a bucket has been created, its location can't be changed.
Read more >Configure log buckets - Google Cloud
This document describes how to create and manage Cloud Logging buckets using the Google Cloud console, the Google Cloud CLI, and the Logging...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This error persist in the version 1.0.863 @carlobongiovanni
@schosterbarak https://github.com/bridgecrewio/checkov/pull/936