checkov
checkov copied to clipboard
fix(terraform): CKV_GCP_32 (GoogleComputeBlockProjectSSH) Add other common enabling values
User description
Description
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.
Fixes # (issue)
New/Edited policies (Delete if not relevant)
- CKV_GCP_32
Description
We have a well established doctrine for this setting and that was to use the following hcl. Unfortunately policy CKV_GCP_32 will fail this (in terraform mode, it detects properly in terraform_json) even though the result is Google enables the setting upon apply.
metadata = {
block-project-ssh-keys = "True"
}
Checklist:
- [X] I have performed a self-review of my own code
- [X] I have commented my code, particularly in hard-to-understand areas
- [X] I have made corresponding changes to the documentation (no relevant entries)
- [X] I have added tests that prove my feature, policy, or fix is effective and works
- [X] New and existing tests pass locally with my changes
Generated description
Dear maintainer, below is a concise technical summary of the changes proposed in this PR:
Enhance the GoogleComputeBlockProjectSSH
class to correctly handle various truthy values for the block-project-ssh-keys
metadata key in Google Compute resources. This change ensures that the policy CKV_GCP_32 does not fail when these values are used in Terraform configurations. The get_expected_values
method now returns a list of acceptable truthy values, including True
, "true", "True", and "TRUE". Additionally, the test suite for this policy has been refactored to consolidate test cases and improve coverage, ensuring that both passing and failing scenarios are accurately captured.
Topic | Details | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
Test Suite Refactor | Refactor and expand the test suite for GoogleComputeBlockProjectSSH to ensure comprehensive coverage of both passing and failing scenarios.Modified files (4)
Latest Contributors(2)
| |||||||||
Policy Enhancement | Enhance the GoogleComputeBlockProjectSSH class to handle multiple truthy values for the block-project-ssh-keys metadata key.Modified files (1)
Latest Contributors(2)
|