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 reflection tables #406

Closed
kaidaguerre opened this issue Apr 19, 2021 · 2 comments
Closed

Add reflection tables #406

kaidaguerre opened this issue Apr 19, 2021 · 2 comments
Assignees
Labels
controls enhancement New feature or request

Comments

@kaidaguerre
Copy link
Contributor

Reflection Tables

Steampipe will parse the .sp files (and other extensions for auto-resources, like .sql), and will add the definition information to a set of reflection tables. These reflection tables will be added to the internal schema, and will allow users to query the mod configuration files using standard postgres syntax. Note that these tables contain only the "definition" information as parsed; Outputs/results are not available as they are ephemeral.

  • steampipe_query
  • steampipe_control
  • steampipe_report
  • steampipe_panel
  • steampipe_variable

Are these a view on a steampipe_resources table?

Required columns for reflection tables

  • mod_name
  • resource_name
  • file_name
  • start_line_number
  • end_line_number
  • auto_generated (bool - true for .sql files, false for .sp files)
  • source_definition

Additional column for each argument

  • commonly:
    • title
    • description
    • query
    • tags
    • sql
-- list all the controls in the aws mod
select * from steampipe_control where mod_name = 'aws'

-- list all the controls with a specific tag value
select * from steampipe_control where tag -> 'cis_version' = '1.3.0'

-- Show the hcl definition of a control
select mod_name, name, source_definition from steampipe_control where mod_name = 'aws' and resource_name = 'aws_cisv130_1_1'

-- show the sql for a query
select mod_name, name, sql from steampipe_query where mod_name = 'aws' and resource_name = 's3_bucket_encryption_in_transit_control'

Is variable interpolation done in the columns? does the query return the statement, or 'query.my_query'?

@kaidaguerre kaidaguerre added the enhancement New feature or request label Apr 19, 2021
@kaidaguerre kaidaguerre self-assigned this Apr 19, 2021
@kaidaguerre
Copy link
Contributor Author

steampipe should populate these tables as part of the workspace loading

@kaidaguerre
Copy link
Contributor Author

closed by 05254c3

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

No branches or pull requests

1 participant