diff --git a/terraform/environments/ppud/iam.tf b/terraform/environments/ppud/iam.tf index aa7104e6601..15ecce0c131 100644 --- a/terraform/environments/ppud/iam.tf +++ b/terraform/environments/ppud/iam.tf @@ -1172,15 +1172,34 @@ resource "aws_iam_policy" "iam_policy_for_lambda_cloudwatch_get_metric_data_dev" policy = jsonencode({ "Version" : "2012-10-17", "Statement" : [{ + "Sid" : "CloudwatchMetricPolicy", "Effect" : "Allow", "Action" : [ - "cloudwatch:GetMetricData" + "cloudwatch:GetMetricData", + "cloudwatch:ListMetrics" ], "Resource" : [ "arn:aws:ssm:eu-west-2:${local.environment_management.account_ids["ppud-development"]}:*" ] }, { + "Sid" : "SQSPolicy", + "Effect" : "Allow", + "Action" : [ + "sqs:ChangeMessageVisibility", + "sqs:DeleteMessage", + "sqs:GetQueueAttributes", + "sqs:GetQueueUrl", + "sqs:ListQueueTags", + "sqs:ReceiveMessage", + "sqs:SendMessage" + ], + "Resource" : [ + "arn:aws:sqs:eu-west-2:${local.environment_management.account_ids["ppud-production"]}:Lambda-Queue-Production" + ] + }, + { + "Sid" : "SESPolicy", "Effect" : "Allow", "Action" : [ "ses:SendEmail" diff --git a/terraform/environments/ppud/lambda.tf b/terraform/environments/ppud/lambda.tf index 302ec946fa5..0cce3c4a951 100644 --- a/terraform/environments/ppud/lambda.tf +++ b/terraform/environments/ppud/lambda.tf @@ -236,11 +236,11 @@ resource "aws_lambda_function" "terraform_lambda_enable_cpu_alarm" { resource "aws_lambda_permission" "allow_cloudwatch_to_call_lambda_terminate_cpu_process_dev" { count = local.is-development == true ? 1 : 0 - statement_id = "AllowExecutionFromCloudWatch" + statement_id = "AllowCloudWatchAccess" action = "lambda:InvokeFunction" function_name = aws_lambda_function.terraform_lambda_func_terminate_cpu_process_dev[0].function_name - principal = "lambda.alarms.cloudwatch.amazonaws.com" - source_arn = "arn:aws:cloudwatch:eu-west-2:${local.environment_management.account_ids["ppud-development"]}:alarm:*" + principal = "cloudwatch.amazonaws.com" + source_arn = "arn:aws:cloudwatch:eu-west-2:${local.environment_management.account_ids["ppud-development"]}:*" } resource "aws_lambda_function" "terraform_lambda_func_terminate_cpu_process_dev" {