Skip to content

Commit bcf8d77

Browse files
Merge pull request #65 from iriusrisk/feature/OPT-111
[OPT-111] to dev
2 parents c91a8f7 + 39dc95c commit bcf8d77

File tree

5 files changed

+621
-1
lines changed

5 files changed

+621
-1
lines changed

startleft/config/default-terraform-mapping.yaml

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,4 +152,136 @@ components:
152152
$source: {$root: "resource[].aws_sfn_activity"}
153153
parent: b61d6911-338d-46a8-9f39-8dcd24abfe91
154154

155+
- id: {$format: "{type}.{name}.id"}
156+
type: CD-ACM
157+
name: {$numberOfSources: {oneSource:{$path: "keys(@)[0]"}, multipleSource:{ $format: "CD-ACM (grouped)" }}}
158+
$source: {$singleton: {$root: "resource[].aws_acm_certificate"}}
159+
parent: b61d6911-338d-46a8-9f39-8dcd24abfe91
160+
161+
- id: {$format: "{type}.{name}.id"}
162+
type: cloudwatch
163+
name: {$numberOfSources: {oneSource:{$path: "keys(@)[0]"}, multipleSource:{ $format: "cloudwatch (grouped)" }}}
164+
$source: {$singleton: {$root: "resource[].aws_cloudwatch_metric_alarm"}}
165+
parent: b61d6911-338d-46a8-9f39-8dcd24abfe91
166+
167+
- id: {$format: "{type}.{name}.id"}
168+
type: kms
169+
name: {$numberOfSources: {oneSource:{$path: "keys(@)[0]"}, multipleSource:{ $format: "kms (grouped)" }}}
170+
$source: {$singleton: {$root: "resource[].aws_kms_key"}}
171+
parent: b61d6911-338d-46a8-9f39-8dcd24abfe91
172+
173+
- id: {$format: "{type}.{name}.id"}
174+
type: cloudwatch
175+
name: {$numberOfSources: {oneSource:{$path: "keys(@)[0]"}, multipleSource:{ $format: "cloudwatch (grouped)" }}}
176+
$source: {$singleton: {$root: "resource[].aws_cloudwatch_log_group"}}
177+
parent: b61d6911-338d-46a8-9f39-8dcd24abfe91
178+
179+
- id: {$format: "{type}.{name}.id"}
180+
type: CD-SECRETS-MANAGER
181+
name: {$numberOfSources: {oneSource:{$path: "keys(@)[0]"}, multipleSource:{ $format: "CD-SECRETS-MANAGER (grouped)" }}}
182+
$source: {$singleton: {$root: "resource[].aws_secretsmanager_secret"}}
183+
parent: b61d6911-338d-46a8-9f39-8dcd24abfe91
184+
185+
- id: {$format: "{type}.{name}.id"}
186+
type: CD-SYSTEMS-MANAGER
187+
name: {$numberOfSources: {oneSource:{$path: "keys(@)[0]"}, multipleSource:{ $format: "CD-SYSTEMS-MANAGER (grouped)" }}}
188+
$source: {$singleton: {$root: "resource[]|filter(@, 'aws_ssm_')"}}
189+
parent: b61d6911-338d-46a8-9f39-8dcd24abfe91
190+
191+
- id: {$format: "{type}.{name}.id"}
192+
type: api-gateway
193+
name: {$numberOfSources: {oneSource:{$path: "keys(@)[0]"}, multipleSource:{ $format: "api-gateway (grouped)" }}}
194+
$source: {$singleton: {$root: "resource[]|filter(@, 'aws_api_gateway_')"}}
195+
parent: b61d6911-338d-46a8-9f39-8dcd24abfe91
196+
197+
- id: {$format: "{type}.{name}.id"}
198+
type: athena
199+
name: {$numberOfSources: {oneSource:{$path: "keys(@)[0]"}, multipleSource:{ $format: "athena (grouped)" }}}
200+
$source: {$singleton: {$root: "resource[]|filter(@, 'aws_athena_')"}}
201+
parent: b61d6911-338d-46a8-9f39-8dcd24abfe91
202+
203+
- id: {$format: "{type}.{name}.id"}
204+
type: CD-MQ
205+
name: {$numberOfSources: {oneSource:{$path: "keys(@)[0]"}, multipleSource:{ $format: "CD-MQ (grouped)" }}}
206+
$source: {$singleton: {$root: "resource[]|filter(@, 'aws_mq_')"}}
207+
parent: b61d6911-338d-46a8-9f39-8dcd24abfe91
208+
209+
- id: {$format: "{type}.{name}.id"}
210+
type: cf-cloudfront
211+
name: {$numberOfSources: {oneSource:{$path: "keys(@)[0]"}, multipleSource:{ $format: "cf-cloudfront (grouped)" }}}
212+
$source: {$singleton: {$root: "resource[]|filter(@, 'aws_cloudfront_')"}}
213+
parent: b61d6911-338d-46a8-9f39-8dcd24abfe91
214+
215+
- id: {$format: "{type}.{name}.id"}
216+
type: CD-CONFIG
217+
name: {$numberOfSources: {oneSource:{$path: "keys(@)[0]"}, multipleSource:{ $format: "CD-CONFIG (grouped)" }}}
218+
$source: {$singleton: {$root: "resource[]|filter(@, 'aws_config_')"}}
219+
parent: b61d6911-338d-46a8-9f39-8dcd24abfe91
220+
221+
- id: {$format: "{type}.{name}.id"}
222+
type: elastic-container-registry
223+
name: {$numberOfSources: {oneSource:{$path: "keys(@)[0]"}, multipleSource:{ $format: "elastic-container-registry (grouped)" }}}
224+
$source: {$singleton: {$root: "resource[]|filter(@, 'aws_ecr_')"}}
225+
parent: b61d6911-338d-46a8-9f39-8dcd24abfe91
226+
227+
- id: {$format: "{type}.{name}.id"}
228+
type: elasticache
229+
name: {$numberOfSources: {oneSource:{$path: "keys(@)[0]"}, multipleSource:{ $format: "elasticache (grouped)" }}}
230+
$source: {$singleton: {$root: "resource[]|filter(@, 'aws_elasticache_')"}}
231+
parent: b61d6911-338d-46a8-9f39-8dcd24abfe91
232+
233+
- id: {$format: "{type}.{name}.id"}
234+
type: CD-GUARDDUTY
235+
name: {$numberOfSources: {oneSource:{$path: "keys(@)[0]"}, multipleSource:{ $format: "CD-GUARDDUTY (grouped)" }}}
236+
$source: {$singleton: {$root: "resource[]|filter(@, 'aws_guardduty_')"}}
237+
parent: b61d6911-338d-46a8-9f39-8dcd24abfe91
238+
239+
- id: {$format: "{type}.{name}.id"}
240+
type: CD-INSPECTOR
241+
name: {$numberOfSources: {oneSource:{$path: "keys(@)[0]"}, multipleSource:{ $format: "CD-INSPECTOR (grouped)" }}}
242+
$source: {$singleton: {$root: "resource[]|filter(@, 'aws_inspector_')"}}
243+
parent: b61d6911-338d-46a8-9f39-8dcd24abfe91
244+
245+
- id: {$format: "{type}.{name}.id"}
246+
type: CD-MACIE
247+
name: {$numberOfSources: {oneSource:{$path: "keys(@)[0]"}, multipleSource:{ $format: "CD-MACIE (grouped)" }}}
248+
$source: {$singleton: {$root: "resource[]|filter(@, 'aws_macie2_')"}}
249+
parent: b61d6911-338d-46a8-9f39-8dcd24abfe91
250+
251+
- id: {$format: "{type}.{name}.id"}
252+
type: CD-SES
253+
name: {$numberOfSources: {oneSource:{$path: "keys(@)[0]"}, multipleSource:{ $format: "CD-SES (grouped)" }}}
254+
$source: {$singleton: {$root: "resource[]|filter(@, 'aws_ses_')"}}
255+
parent: b61d6911-338d-46a8-9f39-8dcd24abfe91
256+
257+
- id: {$format: "{type}.{name}.id"}
258+
type: sns
259+
name: {$numberOfSources: {oneSource:{$path: "keys(@)[0]"}, multipleSource:{ $format: "sns (grouped)" }}}
260+
$source: {$singleton: {$root: "resource[]|filter(@, 'aws_sns_')"}}
261+
parent: b61d6911-338d-46a8-9f39-8dcd24abfe91
262+
263+
- id: {$format: "{type}.{name}.id"}
264+
type: CD-WAF
265+
name: {$numberOfSources: {oneSource:{$path: "keys(@)[0]"}, multipleSource:{ $format: "CD-WAF (grouped)" }}}
266+
$source: {$singleton: {$root: "resource[]|filter(@, 'aws_waf_')"}}
267+
parent: b61d6911-338d-46a8-9f39-8dcd24abfe91
268+
269+
- id: {$format: "{type}.{name}.id"}
270+
type: kinesis-data-analytics
271+
name: {$numberOfSources: {oneSource:{$path: "keys(@)[0]"}, multipleSource:{ $format: "kinesis-data-analytics (grouped)" }}}
272+
$source: {$singleton: {$root: "resource[]|filter(@, 'aws_kinesis_analytics_')"}}
273+
parent: b61d6911-338d-46a8-9f39-8dcd24abfe91
274+
275+
- id: {$format: "{type}.{name}.id"}
276+
type: kinesis-data-analytics
277+
name: {$numberOfSources: {oneSource:{$path: "keys(@)[0]"}, multipleSource:{ $format: "kinesis-data-analytics (grouped)" }}}
278+
$source: {$singleton: {$root: "resource[]|filter(@, 'aws_kinesis_stream')"}}
279+
parent: b61d6911-338d-46a8-9f39-8dcd24abfe91
280+
281+
- id: {$format: "{type}.{name}.id"}
282+
type: kinesis-data-firehose
283+
name: {$numberOfSources: {oneSource:{$path: "keys(@)[0]"}, multipleSource:{ $format: "kinesis-data-firehose (grouped)" }}}
284+
$source: {$singleton: {$root: "resource[]|filter(@, 'aws_kinesis_firehose_')"}}
285+
parent: b61d6911-338d-46a8-9f39-8dcd24abfe91
286+
155287
dataflows: []

startleft/sourcemodel.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,18 @@ def _func_squash(self, obj):
2222
if isinstance(v, dict):
2323
v["_key"] = k
2424
temp.append(v)
25-
return temp
25+
return temp
26+
27+
@jmespath.functions.signature({'types': ['array']}, {'types': ['string']})
28+
def _func_filter(self, obj_arr, match):
29+
temp = []
30+
31+
for obj in obj_arr:
32+
for key in obj.keys():
33+
if key.startswith(match):
34+
temp.append(obj)
35+
36+
return temp
2637

2738

2839
class SourceModel:

0 commit comments

Comments
 (0)