Details has not been printed
See original GitHub issueDescribe the issue I’m trying to add details to a custom policy, but it has not been printed. Run: On MacOS and on Github Action checkov-action@v12.1943.0 Version: 2.2.168 Additional context
MANDATORY_TAGS = [ “Application”, “Env”, “Team”, ]
class MandatoryTags(BaseResourceCheck):
def __init__(self):
name = "Ensure all resources has madatory tags"
id = "CUSTOM_AWS_001"
supported_resources = ['aws_kms_key']
categories = [CheckCategories.GENERAL_SECURITY]
guideline = "Check page blah blah"
super().__init__(name=name, id=id, categories=categories,
supported_resources=supported_resources, guideline=guideline)
def scan_resource_conf(self, conf):
if 'tags_all' in conf.keys():
resource_tags = list(conf['tags_all'][0].keys())
if not all(tag in resource_tags for tag in MANDATORY_TAGS):
self.details.append("default_tags need to be set on provider level")
return CheckResult.FAILED
return CheckResult.PASSED
check = MandatoryTags()
** output **
"check_id": "CUSTOM_AWS_001", "bc_check_id": null, "check_name": "Ensure all resources has mandatory tags", "check_result": { "result": "FAILED", "evaluated_keys": [] }, "code_block": [...], "file_path": "/plan_fmt.json", "file_abs_path": "/private/tmp/platform-checkov-custom-policies/plan_fmt.json", "repo_file_path": "/plan_fmt.json", "file_line_range": [...], "resource": "aws_kms_key.default", "evaluations": null, "check_class": "CheckMandatoryTags", "fixed_definition": null, "entity_tags": null, "caller_file_path": null, "caller_file_line_range": null, "resource_address": "aws_kms_key.default", "severity": null, "bc_category": null, "benchmarks": null, "description": null, "short_description": null, "vulnerability_details": null, "connected_node": null, "guideline": "", "details": [], "check_len": null },
In the output, it shows the details list as empty.
Issue Analytics
- State:
- Created 9 months ago
- Comments:6
Top GitHub Comments
found the issue, thanks. The details were just added for normal Terraform scans and not for Terraform plan scans.
it should be included with version
2.2.179