Skip to content

Commit aa5efcc

Browse files
authored
add support to pass a kms to encrypt cloudwatch log groups (#20)
1 parent 00fb798 commit aa5efcc

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ resource "aws_iam_role_policy" "logs_role_policy" {
142142
resource "aws_cloudwatch_log_group" "log_group" {
143143
name = "/aws/lambda/${var.name}"
144144
tags = var.tags
145+
kms_key_id = var.cloudwatch_log_groups_kms_arn
145146
}
146147

147148
/**

variables.tf

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ variable plaintext_params {
6060
const config = JSON.parse(readFileSync('./config.json'))
6161
const someConfigValue = config.SomeKey
6262
```
63-
63+
6464
Compared to var.ssm_params, you should use this variable when you have non-secret things that you want very quick access
6565
to during the execution of your lambda function.
6666
EOF
@@ -71,7 +71,7 @@ variable ssm_params {
7171
default = {}
7272
description = <<EOF
7373
Lambda@Edge does not support env vars, so it is a common pattern to exchange Env vars for SSM params.
74-
74+
7575
So instead of using env vars like:
7676
`const someEnvValue = process.env.SOME_ENV`
7777
@@ -92,3 +92,10 @@ variable ssm_params {
9292
in your lambda .zip file. These params will need to be fetched via a Promise at runtime, so there may be small performance delays.
9393
EOF
9494
}
95+
96+
variable cloudwatch_log_groups_kms_arn {
97+
type = string
98+
description = "KMS ARN to encrypt the log group in cloudwatch"
99+
default = null
100+
}
101+

0 commit comments

Comments
 (0)