github.com/turbot/steampipe@v1.7.0-rc.0.0.20240517123944-7cef272d4458/tests/manual_testing/demo/variables_demo/query.sp (about) 1 variable "query1"{ 2 type = string 3 description = "string variable with a default" 4 default = "select 'var.query1'" 5 } 6 variable "column" { 7 description = "string variable with no default" 8 type=string 9 } 10 11 variable "regions"{ 12 type = list(string) 13 description = "string array variable with default" 14 default = ["eu-west2", "us-east1"] 15 } 16 17 variable "queries" { 18 type = list(object({ 19 query = string 20 metadata = string 21 22 })) 23 description = "object array variable with default" 24 default = [ 25 { 26 metadata = "foo" 27 query = "select * from aws_account" 28 }, 29 { 30 metadata = "bar" 31 query = "select * from aws_iam_group" 32 } 33 ] 34 } 35 36 37 query "q1"{ 38 description = "use variable within a string" 39 sql = "select ${var.column}" 40 } 41 42 query "q2"{ 43 title ="Q2" 44 description = "accounts" 45 sql = var.queries[0].query 46 } 47 query "q3"{ 48 title ="Q2" 49 description = "groups" 50 sql = var.queries[1].query 51 }