File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed
Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,12 @@ locals {
1111 dps_bucket_arn_for_extended_attribute = [
1212 " arn:aws:s3:::${ local . dps_bucket_name_for_extended_attribute } /*"
1313 ]
14+
15+ dps_kms_key_alias = (
16+ var. environment == " prod"
17+ ? " nhsd-dspp-core-prod-extended-attributes-gdp-key"
18+ : " nhsd-dspp-core-ref-extended-attributes-gdp-key"
19+ )
1420}
1521
1622
@@ -268,7 +274,12 @@ resource "aws_iam_policy" "filenameprocessor_dps_extended_attribute_kms_policy"
268274 " kms:GenerateDataKey" ,
269275 " kms:DescribeKey"
270276 ],
271- Resource = " arn:aws:kms:eu-west-2:${ var . dspp_core_account_id } :key/*"
277+ Resource = " arn:aws:kms:eu-west-2:${ var . dspp_core_account_id } :key/*" ,
278+ " Condition" = {
279+ " ForAnyValue:StringLike" = {
280+ " kms:ResourceAliases" = " alias/${ local . dps_kms_key_alias } "
281+ }
282+ }
272283 }
273284 ]
274285 })
@@ -283,7 +294,7 @@ resource "aws_iam_role_policy_attachment" "filenameprocessor_lambda_exec_policy_
283294# Attach the dps kms policy to the Lambda role
284295resource "aws_iam_role_policy_attachment" "filenameprocessor_lambda_dps_kms_ea_policy_attachment" {
285296 role = aws_iam_role. filenameprocessor_lambda_exec_role . name
286- policy_arn = aws_iam_policy. filenameprocessor_dps_extended_attribute_kms_policy
297+ policy_arn = aws_iam_policy. filenameprocessor_dps_extended_attribute_kms_policy . arn
287298}
288299
289300# Attach the SQS policy to the Lambda role
You can’t perform that action at this time.
0 commit comments