turbot/steampipe-plugin-gcp

Ensure disabled API errors are sent to the user

jchrisfarris opened this issue · 1 comments

Is your feature request related to a problem? Please describe.
When attempting to query cloud SQL, the following happened.

Chris-Turbot:fried-piper chris$ steampipe query
Welcome to Steampipe v0.18.0
For more information, type .help
> select
  name,
  state,
  instance_type,
  database_version,
  machine_type,
  location
from
  gcp_sql_database_instance;
+------+-------+---------------+------------------+--------------+----------+
| name | state | instance_type | database_version | machine_type | location |
+------+-------+---------------+------------------+--------------+----------+
+------+-------+---------------+------------------+--------------+----------+

Time: 1.1s.
>
Chris-Turbot:fried-piper chris$ gcloud sql instances list
API [sqladmin.googleapis.com] not enabled on project [199594237993]. Would you like to enable and retry (this will take a few
minutes)? (y/N)?  y

Enabling service [sqladmin.googleapis.com] on project [199594237993]...
Operation "operations/acat.p2-199594237993-99118ea7-37b4-4bdc-a89d-5330d3dbe03c" finished successfully.
NAME                                  DATABASE_VERSION  LOCATION    TIER         PRIMARY_ADDRESS  PRIVATE_ADDRESS  STATUS
terraform-20230120141445740200000001  MYSQL_8_0         us-east1-c  db-g1-small  34.138.100.98    -                RUNNABLE
Chris-Turbot:fried-piper chris$ steampipe query
Welcome to Steampipe v0.18.0
For more information, type .help
> select
  name,
  state,
  instance_type,
  database_version,
  machine_type,
  location
from
  gcp_sql_database_instance;
+--------------------------------------+----------+--------------------+------------------+--------------+----------+
| name                                 | state    | instance_type      | database_version | machine_type | location |
+--------------------------------------+----------+--------------------+------------------+--------------+----------+
| terraform-20230120141445740200000001 | RUNNABLE | CLOUD_SQL_INSTANCE | MYSQL_8_0        | db-g1-small  | us-east1 |
+--------------------------------------+----------+--------------------+------------------+--------------+----------+

Time: 1.3s. Rows fetched: 1. Hydrate calls: 0.

Describe the solution you'd like
The gcloud CLI tool clearly told me the error. Steampipe left me with the impression there were no databases running.

As a user, If I had not just created the database, I would have assumed that there were no databases in my project, and thus no security risks associated with the databases.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

Closed as a part of #432