-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsteampipe_query.fp
170 lines (133 loc) · 2.91 KB
/
steampipe_query.fp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
locals {
query = <<-EOQ
select
name,
arn,
region,
account_id
from
aws_s3_bucket
where
tags is null;
EOQ
}
pipeline "query_steampipe"{
step "query" "s3" {
database = connection.steampipe.default
sql = "select * from aws_s3_bucket"
}
output "s3" {
value = step.query.s3
}
}
trigger "query" "s3_buckets" {
title = "Simple"
enabled = true
database = var.database
sql = local.query
capture "insert" {
pipeline = pipeline.send_list
args = {
items = self.inserted_rows
}
}
}
pipeline "send_list" {
param "items" {
type = list(object({
name = string
arn = string
region = string
account_id = string
}))
}
step "transform" "echo" {
value = param.items
}
output "val" {
value = step.transform.echo
}
}
trigger "query" "with_delay" {
title = "With Delay"
enabled = true
database = connection.steampipe.default
sql = local.query
capture "insert" {
pipeline = pipeline.get_input
args = {
items = self.inserted_rows
}
}
}
trigger "query" "with_delay_and_sleep" {
title = "With Delay and Sleep"
enabled = true
database = connection.steampipe.default
sql = local.query
capture "insert" {
pipeline = pipeline.get_input_with_sleep
args = {
items = self.inserted_rows
}
}
}
pipeline "get_input_with_sleep" {
title = "Get Input With Sleep"
param "items" {
type = list(object({
name = string
arn = string
region = string
account_id = string
}))
}
param "notifier" {
type = notifier
default = var.notifier
}
step "transform" "build_string" {
value = "${length(param.items)} items: ${join(", ", [for item in param.items : item.name])}"
}
step "sleep" "sleep" {
duration = "5m"
}
step "input" "delay" {
type = "button"
prompt = "This is a delay for purposes of pausing pipeline; respond after it's paused to attempt to resume."
notifier = param.notifier
option "Continue" {}
option "Yes" {}
}
step "transform" "do_nothing" {
value = "${step.input.delay.value}"
}
}
pipeline "get_input" {
title = "Get Input Without Sleep"
param "items" {
type = list(object({
name = string
arn = string
region = string
account_id = string
}))
}
param "notifier" {
type = notifier
default = var.notifier
}
step "transform" "build_string" {
value = "${length(param.items)} items: ${join(", ", [for item in param.items : item.name])}"
}
step "input" "delay" {
type = "button"
prompt = "This is a delay for purposes of pausing pipeline; respond after it's paused to attempt to resume."
notifier = param.notifier
option "Continue" {}
option "Yes" {}
}
step "transform" "do_nothing" {
value = "${step.input.delay.value}"
}
}