File tree Expand file tree Collapse file tree 3 files changed +32
-3
lines changed
Expand file tree Collapse file tree 3 files changed +32
-3
lines changed Original file line number Diff line number Diff line change @@ -57,8 +57,7 @@ module "lambda" {
5757 # Logging
5858 is_create_cloudwatch_log_group = true # Default is `true`
5959 cloudwatch_log_retention_in_days = 90 # Default is `90`
60- cloudwatch_log_group_kms_key_arn = " arn:aws:kms:ap-southeast-1:562563527952:key/73ab5420-3183-4185-83de-19f6137cb13c"
61-
60+ additional_lambda_log_group_kms_policy = data. aws_iam_policy_document . allow_github_oidc . json
6261 # Env
6362 ssm_params = {}
6463 environment_variables = {
@@ -72,3 +71,27 @@ module "lambda" {
7271
7372 tags = var. generic_info . custom_tags
7473}
74+
75+
76+ data "aws_iam_policy_document" "allow_github_oidc" {
77+ statement {
78+ sid = " AllowGitHubActionsEncryptDecrypt"
79+ effect = " Allow"
80+
81+ principals {
82+ type = " AWS"
83+ identifiers = [
84+ " arn:aws:iam::562563527952:role/oozou-internal-devops-github-action-oidc-role"
85+ ]
86+ }
87+
88+ actions = [
89+ " kms:Encrypt" ,
90+ " kms:Decrypt" ,
91+ " kms:GenerateDataKey*" ,
92+ " kms:DescribeKey"
93+ ]
94+
95+ resources = [" *" ]
96+ }
97+ }
Original file line number Diff line number Diff line change @@ -340,7 +340,7 @@ module "cloudwatch_log_group_kms" {
340340 key_type = " service"
341341 append_random_suffix = true
342342 description = format (" Secure Secrets Manager's service secrets for service %s" , local. name )
343- additional_policies = [data . aws_iam_policy_document . cloudwatch_log_group_kms_policy . json ]
343+ additional_policies = [data . aws_iam_policy_document . cloudwatch_log_group_kms_policy . json , var . additional_lambda_log_group_kms_policy ]
344344
345345 tags = merge (local. tags , { " Name" : format (" %s-function-log-group" , var. name ) })
346346}
Original file line number Diff line number Diff line change @@ -213,3 +213,9 @@ variable "ssm_params" {
213213 type = map (string )
214214 default = {}
215215}
216+
217+ variable "additional_lambda_log_group_kms_policy" {
218+ description = " Additional IAM policy document for the Lambda log group KMS key."
219+ type = string
220+ default = null
221+ }
You can’t perform that action at this time.
0 commit comments