diff --git a/terraform/environments/ppud/iam.tf b/terraform/environments/ppud/iam.tf index c2c40933966..aa7104e6601 100644 --- a/terraform/environments/ppud/iam.tf +++ b/terraform/environments/ppud/iam.tf @@ -1138,4 +1138,62 @@ resource "aws_iam_role_policy_attachment" "attach_aws_signer_policy_to_aws_signe count = local.is-development == true ? 1 : 0 role = aws_iam_role.aws_signer_role_dev[0].name policy_arn = aws_iam_policy.aws_signer_policy_dev[0].arn -} \ No newline at end of file +} + +############################################# +# IAM Role & Policy for Send CPU graph - DEV +############################################# + +resource "aws_iam_role" "lambda_role_cloudwatch_get_metric_data_dev" { + count = local.is-development == true ? 1 : 0 + name = "PPUD_Lambda_Function_Role_Cloudwatch_Get_Metric_Data_Dev" + assume_role_policy = <

{email_body}

" + ) + + try: + ses.send_email( + Source=email_sender, + Destination={'ToAddresses': [email_recipient]}, + Message={ + 'Subject': {'Data': email_subject}, + 'Body': { + 'Html': {'Data': email_html_body} + } + } + ) + print(f"Email sent successfully to {email_recipient}") + except ClientError as e: + print(f"Error sending email: {e}") + return {'statusCode': 500, 'body': str(e)} + + return {'statusCode': 200, 'body': 'Email sent successfully'}