Skip to content
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

Add table gcp_compute_machine_images #517

Closed
roboticpuppies opened this issue Nov 30, 2023 · 1 comment · Fixed by #519
Closed

Add table gcp_compute_machine_images #517

roboticpuppies opened this issue Nov 30, 2023 · 1 comment · Fixed by #519
Assignees
Labels
enhancement New feature or request new table New table request

Comments

@roboticpuppies
Copy link

Hello. Currently, there is no table that contains Machine Images in GCP. Machine Images is similar to AMI (Amazon Machine Images) in AWS.

References

@roboticpuppies roboticpuppies added enhancement New feature or request new table New table request labels Nov 30, 2023
@ParthaI ParthaI linked a pull request Dec 5, 2023 that will close this issue
@ParthaI
Copy link
Contributor

ParthaI commented Dec 6, 2023

Thank you, @roboticpuppies, for bringing this issue to our attention. Your involvement with Steampipe is greatly valued.

I've submitted a PR addressing this issue. If you would like to test it on the PR branch (issue-517). Here are the steps to do so:

  1. Clone the repository: git clone https://github.com/turbot/steampipe-plugin-gcp.git
  2. Navigate to the directory: cd steampipe-plugin-gcp
  3. Switch to the issue-517 branch: git checkout issue-517
  4. Build the project: make
  5. Execute the query: select * from gcp_compute_machine_image

Additionally, There is another table, gcp_compute_machine_type, which might be useful for you. It allows you to find available machine types per zone in a project.

FYI, here is the query to get the Machine Type details for Machine Images:

> select
  i.name as image_name,
  i.id image_id,
  i.instance_properties ->> 'machineType' as machine_type,
  t.creation_timestamp as machine_type_creation_timestamp,
  t.memory_mb as machine_type_memory_mb,
  t.maximum_persistent_disks as machine_type_maximum_persistent_disks,
  t.is_shared_cpu as machine_type_is_shared_cpu,
  t.zone as machine_type_zone,
  t.deprecated as machine_type_deprecated
from
  gcp_compute_machine_image as i,
  gcp_compute_machine_type as t
where
  t.name = (i.instance_properties ->> 'machineType') and t.zone = split_part(i.source_instance, '/', 9);
+-----------------+---------------------+--------------+---------------------------------+------------------------+---------------------------------------+----------------------------+-------------------+-------------------------+
| image_name      | image_id            | machine_type | machine_type_creation_timestamp | machine_type_memory_mb | machine_type_maximum_persistent_disks | machine_type_is_shared_cpu | machine_type_zone | machine_type_deprecated |
+-----------------+---------------------+--------------+---------------------------------+------------------------+---------------------------------------+----------------------------+-------------------+-------------------------+
| turbottest38122 | 3376754139384885550 | f1-micro     | 1970-01-01T05:30:00+05:30       | 614                    | 16                                    | true                       | us-east1-b        | <null>                  |
+-----------------+---------------------+--------------+---------------------------------+------------------------+---------------------------------------+----------------------------+-------------------+-------------------------+

Time: 5.5s. Rows fetched: 15,014. Hydrate calls: 0.

Please feel free to reach out if there's anything else you need.

Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request new table New table request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants