-
Notifications
You must be signed in to change notification settings - Fork 18
/
cloudtrail_trail_report_encryption.sp
61 lines (49 loc) · 1.23 KB
/
cloudtrail_trail_report_encryption.sp
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
dashboard "cloudtrail_trail_encryption_report" {
title = "AWS CloudTrail Trail Encryption Report"
documentation = file("./dashboards/cloudtrail/docs/cloudtrail_trail_report_encryption.md")
tags = merge(local.cloudtrail_common_tags, {
type = "Report"
category = "Encryption"
})
container {
card {
query = query.cloudtrail_trail_count
width = 3
}
card {
query = query.cloudtrail_trail_unencrypted_count
width = 3
}
}
table {
column "Account ID" {
display = "none"
}
column "ARN" {
display = "none"
}
column "Name" {
href = "${dashboard.cloudtrail_trail_detail.url_path}?input.trail_arn={{.ARN | @uri}}"
}
query = query.cloudtrail_trail_encryption_table
}
}
query "cloudtrail_trail_encryption_table" {
sql = <<-EOQ
select
t.name as "Name",
case when t.kms_key_id is not null then 'Enabled' else null end as "Encryption",
a.title as "Account",
t.account_id as "Account ID",
t.region as "Region",
t.arn as "ARN"
from
aws_cloudtrail_trail as t,
aws_account as a
where
t.home_region = t.region
and t.account_id = a.account_id
order by
t.name;
EOQ
}