Skip to content

Commit

Permalink
Add enabled property for gcp.project.dataproc. Only query clusters if… (
Browse files Browse the repository at this point in the history
#940)

… service's enabled (#939)

Fixes #938, the `DataProc Cloud` service can also be disabled for a
project, which means we cannot fetch clusters from it. To fix this, I am
adding an `enabled` field to the service and skipping clusters retrieval
if the service is disabled:

On a GCP with DataProc disabled
```
cnquery> gcp.project.dataproc.enabled
[failed] gcp.project.dataproc.enabled
  expected: == true
  actual:   false

cnquery> gcp.project.dataproc.clusters
! DataProc Cloud API is not enabled, not querying clusters
gcp.project.dataproc.clusters: []
```

On a GCP with DataProc enabled
```
cnquery> gcp.project.dataproc.enabled
[ok] value: true

cnquery> gcp.project.dataproc.clusters
gcp.project.dataproc.clusters: []
```

We should probably do this for all GCP services since most of them can
be disabled


 - [x] Test with a `cnspec scan`
  • Loading branch information
preslavgerchev authored Feb 15, 2023
1 parent 4ca9744 commit 17cec10
Show file tree
Hide file tree
Showing 4 changed files with 433 additions and 368 deletions.
Loading

0 comments on commit 17cec10

Please sign in to comment.