From 9f4c65a5e1681bcc89274cfb47953af95e573a5c Mon Sep 17 00:00:00 2001 From: Oluwatunmise-olat Date: Tue, 30 Jan 2024 09:55:55 +0100 Subject: [PATCH] chore: update config --- infra/main.tf | 2 +- infra/outputs.tf | 3 +++ infra/serverless/main.tf | 12 +++++++++--- src/shared/validations/conf.validation.ts | 8 ++++---- 4 files changed, 17 insertions(+), 8 deletions(-) create mode 100644 infra/outputs.tf diff --git a/infra/main.tf b/infra/main.tf index 4bd0e1e..294db3a 100644 --- a/infra/main.tf +++ b/infra/main.tf @@ -1,4 +1,4 @@ module "serverless_module" { aws_preexisting_ecr = var.aws_preexisting_ecr - source = "./serverless" + source = "./serverless" } \ No newline at end of file diff --git a/infra/outputs.tf b/infra/outputs.tf new file mode 100644 index 0000000..15d480e --- /dev/null +++ b/infra/outputs.tf @@ -0,0 +1,3 @@ +output "serverless_module" { + value = module.serverless_module +} \ No newline at end of file diff --git a/infra/serverless/main.tf b/infra/serverless/main.tf index d4db8f6..abb79c1 100644 --- a/infra/serverless/main.tf +++ b/infra/serverless/main.tf @@ -2,7 +2,7 @@ ///////////// DynamoDB /////////////////// ////////////////////////////////////////// resource "aws_dynamodb_table" "audio_sync" { - name = "audio_sync_x" + name = "audio_sync_x" // <- Name should align with code billing_mode = "PAY_PER_REQUEST" hash_key = "video_id" @@ -16,7 +16,7 @@ resource "aws_dynamodb_table" "audio_sync" { ///////////// Create S3 Bucket /////////// ////////////////////////////////////////// resource "aws_s3_bucket" "audio_sync_s3" { - bucket = "audio-sync-s3-bucket-prem" + bucket = "audio-sync-s3-bucket-prem" // <- Bucket name should align with code force_destroy = true } @@ -64,7 +64,7 @@ resource "aws_sqs_queue" "audio_sync_fifo_queue" { ////////////////////////////////////////// resource "aws_ecr_repository" "audio_sync_ecr" { name = "audio_sync" - image_tag_mutability = "IMMUTABLE" + image_tag_mutability = "MUTABLE" image_scanning_configuration { scan_on_push = true @@ -122,6 +122,12 @@ resource "aws_lambda_function" "audio_sync_lambda_function" { memory_size = 1024 timeout = 900 role = aws_iam_role.lambda_role.arn + environment { + variables = { + "SES_SENDER_MAIL" = "test@gmail.com" // <- use your verified email address, + "SQS_URL" = aws_sqs_queue.audio_sync_fifo_queue.url + } + } logging_config { log_format = "JSON" diff --git a/src/shared/validations/conf.validation.ts b/src/shared/validations/conf.validation.ts index 2ba0da2..df57a9a 100644 --- a/src/shared/validations/conf.validation.ts +++ b/src/shared/validations/conf.validation.ts @@ -2,11 +2,11 @@ import { Joi } from "celebrate"; export const configRule = Joi.object({ /** Aws Configs */ - SES_PASSWORD: Joi.string().required(), - SES_USERNAME: Joi.string().required(), + SES_PASSWORD: Joi.string().optional(), + SES_USERNAME: Joi.string().optional(), SES_SENDER_MAIL: Joi.string().required(), - SECRET_ACCESS_KEY: Joi.string().required(), - ACCESS_KEY_ID: Joi.string().required(), + SECRET_ACCESS_KEY: Joi.string().optional(), + ACCESS_KEY_ID: Joi.string().optional(), AWS_REGION: Joi.string().required(), SQS_URL: Joi.string().required(),