Repository: bridgecrewio/checkov

Issue:
CKV_GCP_29 - Checks failed after GCP resource renamed
**Describe the bug**
Google has renamed the value
`bucket_policy_only ` to `uniform_bucket_level_access`.

When adding the new value in the configuration the check CKV_GCP_29 ( Ensure that Cloud Storage buckets have uniform bucket-level access enabled ) still fails as it is still looking for the old value

**To Reproduce**
Steps to reproduce the behavior:
1. On tearragoat, add the value `uniform_bucket_level_access = true` and the checks will still fail


**Expected behavior**
The check should pass.



Discussion:
Raising a PR now.
Can't raise a PR :(

The file that needs the fix is:
```
checkov/terraform/checks/resource/gcp/GoogleStorageBucketUniformAccess.py
```
Have tested it locally and works as expected after modifying that file, but looks like I am not allowed to push back to a new branch :( 

Thank you!
Are you pushing to a branch on your own fork? Then raising a PR from there? Should work, if not, happy to raise the PR on your behalf, could you share a `git diff`? thanks!

I tried to push to a branch straight to this repo:
```
git push --set-upstream origin issue_589
ERROR: Permission to bridgecrewio/checkov.git denied to hpapadopoulos.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
```
git diff
```diff
--- a/checkov/terraform/checks/resource/gcp/GoogleStorageBucketUniformAccess.py
+++ b/checkov/terraform/checks/resource/gcp/GoogleStorageBucketUniformAccess.py
@@ -11,7 +11,7 @@ class GoogleStorageBucketUniformAccess(BaseResourceValueCheck):
         super().__init__(name=name, id=id, categories=categories, supported_resources=supported_resources)

     def get_inspected_key(self):
-        return 'bucket_policy_only/[0]'
+        return 'uniform_bucket_level_access/[0]'
Thanks, yes the only way to submit a PR would be to fork checkov, push a branch to your own fork, then submit a PR from that branch (github will offer to create a PR to bridgecrewio/checkov from your own fork once you push your new branch to your fork :) 

With the change, is it possible some versions of the terraform module will still be using `bucket_policy_only/[0]`? so we'd need to check for one or the other? Or has the `bucket_policy_only/[0]` option been removed from GCP?

Ah, good point and you're correct! It is marked as deprecated but is still present and will be fully removed in the next major release. So a check for either one would be better.

Resolving patch:
diff --git a/checkov/terraform/checks/resource/gcp/GoogleStorageBucketUniformAccess.py b/checkov/terraform/checks/resource/gcp/GoogleStorageBucketUniformAccess.py
--- a/checkov/terraform/checks/resource/gcp/GoogleStorageBucketUniformAccess.py
+++ b/checkov/terraform/checks/resource/gcp/GoogleStorageBucketUniformAccess.py
@@ -11,7 +11,7 @@ def __init__(self):
         super().__init__(name=name, id=id, categories=categories, supported_resources=supported_resources)
 
     def get_inspected_key(self):
-        return 'bucket_policy_only/[0]'
+        return 'uniform_bucket_level_access/[0]/bucket_policy_only/[0]'
 
 
 check = GoogleStorageBucketUniformAccess()


Test patch:
diff --git a/tests/terraform/checks/resource/gcp/test_GoogleStorageBucketUniformAccess.py b/tests/terraform/checks/resource/gcp/test_GoogleStorageBucketUniformAccess.py
--- a/tests/terraform/checks/resource/gcp/test_GoogleStorageBucketUniformAccess.py
+++ b/tests/terraform/checks/resource/gcp/test_GoogleStorageBucketUniformAccess.py
@@ -20,13 +20,13 @@ def test_failure(self):
         scan_result = check.scan_resource_conf(conf=resource_conf)
         self.assertEqual(CheckResult.FAILED, scan_result)
 
-    def test_success(self):
+    def test_success_bucket_policy(self):
         hcl_res = hcl2.loads("""
                         resource "google_storage_bucket" "static-site" {
                           name          = "image-store.com"
                           location      = "EU"
                           force_destroy = true
-                          
+
                           bucket_policy_only = true
                         }
                         """)
@@ -34,6 +34,20 @@ def test_success(self):
         scan_result = check.scan_resource_conf(conf=resource_conf)
         self.assertEqual(CheckResult.PASSED, scan_result)
 
+    def test_success_bucket_uniform(self):
+         hcl_res = hcl2.loads("""
+                         resource "google_storage_bucket" "static-site" {
+                           name          = "image-store.com"
+                           location      = "EU"
+                           force_destroy = true
+
+                           uniform_bucket_level_access = true
+                         }
+                         """)
+         resource_conf = hcl_res['resource'][0]['google_storage_bucket']['static-site']
+         scan_result = check.scan_resource_conf(conf=resource_conf)
+         self.assertEqual(CheckResult.PASSED, scan_result)
+
 
 if __name__ == '__main__':
     unittest.main()