-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
⭐️ GCP resources as assets P0 #819
Conversation
e7ecbab
to
0c3d33e
Compare
} | ||
|
||
func NewMQLAssetsDiscovery(provider *gcpprovider.Provider) (*MqlDiscovery, error) { | ||
m, err := motor.New(provider) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not yet sure if this will work if you pass credentials to authenticate, I had the same trouble with Azure.
Basically, the secret in the provider is unresolved and you need to resolve this by using the credentials query that the resolver gets passed.
This is the same reason why we use motor.NewMotorConnection
in the resolver directly instead of motor.New
.
Tldr: Should probably be using motor.NewMotorConnection
here
Edit: It actually depends on how you're passing the provider down to these objects. If you're using the one that you get initially from calling motor.NewMotorConnection
then it is probably fine 🤷
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'm not sure i understand -- can you give an example of what you mean when you say "pass credentials to authenticate", like the command you're using/thinking of?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can describe that. I have this inventory file for GCP:
apiVersion: v1
kind: Inventory
metadata:
name: inventory
spec:
assets:
- name: cool-stuff
connections:
- backend: 13
credentials:
- secret_id: storage/random-bucket2/foo
type: 6
secret_encoding: 3
options:
discover:
targets:
- compute-images
- projects
vault:
name: gcp-berglas
type: gcp-berglas
options:
project_id: mondoo-dev-262313
That breaks with discovering assets because the secret isn't resolved by default
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 thanks for the example!
6b608f9
to
c4ed964
Compare
Signed-off-by: Ivan Milchev <[email protected]>
Signed-off-by: Ivan Milchev <[email protected]>
Signed-off-by: Ivan Milchev <[email protected]>
Signed-off-by: Ivan Milchev <[email protected]>
Signed-off-by: Ivan Milchev <[email protected]>
Signed-off-by: Ivan Milchev <[email protected]>
Signed-off-by: Ivan Milchev <[email protected]>
Signed-off-by: Ivan Milchev <[email protected]>
Signed-off-by: Ivan Milchev <[email protected]>
Signed-off-by: Ivan Milchev <[email protected]>
Signed-off-by: Ivan Milchev <[email protected]>
Signed-off-by: Ivan Milchev <[email protected]>
Signed-off-by: Ivan Milchev <[email protected]>
6fac0e4
to
bf94304
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks for all the new assets 🎉
lookin good! do you have a policy ready that we can test this with? |
i'm gonna give this another local test after planning this morning so we can get to merging! |
The following GCP assets are added as potential discovery options when scanning GCP:
./cnquery shell gcp --discover compute-images
./cnquery shell gcp --discover gke-clusters
./cnquery shell gcp --discover compute-firewalls
./cnquery shell gcp --discover storage-buckets
./cnquery shell gcp --discover compute-networks
./cnquery shell gcp --discover compute-subnetworks
./cnquery shell gcp --discover bigquery-datasets