-
Notifications
You must be signed in to change notification settings - Fork 3
/
cloudwatch.sp
79 lines (66 loc) · 2.98 KB
/
cloudwatch.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
locals {
cloudwatch_compliance_common_tags = merge(local.terraform_aws_compliance_common_tags, {
service = "AWS/CloudWatch"
})
}
benchmark "cloudwatch" {
title = "CloudWatch"
description = "This benchmark provides a set of controls that detect Terraform AWS CloudWatch resources deviating from security best practices."
children = [
control.cloudwatch_alarm_action_enabled,
control.cloudwatch_destination_policy_wildcards,
control.cloudwatch_log_group_retention,
control.cloudwatch_log_group_retention_period_365,
control.log_group_encryption_at_rest_enabled
]
tags = merge(local.cloudwatch_compliance_common_tags, {
type = "Benchmark"
})
}
control "cloudwatch_alarm_action_enabled" {
title = "CloudWatch alarm action should be enabled"
description = "Amazon CloudWatch alarms alert when a metric breaches the threshold for a specified number of evaluation periods. The alarm performs one or more actions based on the value of the metric or expression relative to a threshold over a number of time periods."
query = query.cloudwatch_alarm_action_enabled
tags = merge(local.cloudwatch_compliance_common_tags, {
hipaa = "true"
nist_800_53_rev_4 = "true"
nist_csf = "true"
soc_2 = "true"
})
}
control "cloudwatch_destination_policy_wildcards" {
title = "Ensure CloudWatch Logs destination policy has no wildcards"
description = "Amazon CloudWatch Logs destination policy should avoid wildcard in 'principals' and 'actions'."
query = query.cloudwatch_destination_policy_wildcards
tags = local.cloudwatch_compliance_common_tags
}
control "cloudwatch_log_group_retention_period_365" {
title = "Log group retention period should be at least 365 days"
description = "Ensure a minimum duration of event log data is retained for your log groups to help with troubleshooting and forensics investigations."
query = query.cloudwatch_log_group_retention_period_365
tags = merge(local.cloudwatch_compliance_common_tags, {
hipaa = "true"
nist_800_53_rev_4 = "true"
rbi_cyber_security = "true"
soc_2 = "true"
})
}
control "log_group_encryption_at_rest_enabled" {
title = "Log group encryption at rest should be enabled"
description = "To help protect sensitive data at rest, ensure encryption is enabled for your Amazon CloudWatch Log Group."
query = query.log_group_encryption_at_rest_enabled
tags = merge(local.cloudwatch_compliance_common_tags, {
gdpr = "true"
hipaa = "true"
nist_800_53_rev_4 = "true"
nist_csf = "true"
rbi_cyber_security = "true"
soc_2 = "true"
})
}
control "cloudwatch_log_group_retention" {
title = "Log group retention period should be set"
description = "Ensure that CloudWatch Log Group specifies retention days."
query = query.cloudwatch_log_group_retention
tags = local.cloudwatch_compliance_common_tags
}