From b3adc999a42001e4d021726cba4e13c78b48a99a Mon Sep 17 00:00:00 2001 From: Dev Singh Date: Tue, 22 Jul 2025 11:10:35 -0400 Subject: [PATCH 01/12] move sqs queues to terraform --- Makefile | 8 +++--- cloudformation/main.yml | 20 +++---------- cspell.config.yaml | 1 + terraform/envs/prod/main.tf | 9 +++--- terraform/envs/qa/main.tf | 4 +++ terraform/modules/sqs/main.tf | 46 ++++++++++++++++++++++++++++++ terraform/modules/sqs/variables.tf | 16 +++++++++++ 7 files changed, 80 insertions(+), 24 deletions(-) create mode 100644 terraform/modules/sqs/main.tf create mode 100644 terraform/modules/sqs/variables.tf diff --git a/Makefile b/Makefile index 8850b949..3a121516 100644 --- a/Makefile +++ b/Makefile @@ -93,7 +93,7 @@ deploy_prod: check_account_prod sam deploy $(common_params) --parameter-overrides $(run_env)=prod $(set_application_prefix)=$(application_key) $(set_application_name)="$(application_name)" S3BucketPrefix="$(s3_bucket_prefix)" @echo "Deploying Terraform..." $(eval MAIN_DISTRIBUTION_ID := $(shell aws cloudformation describe-stacks --stack-name $(application_key) --query "Stacks[0].Outputs[?OutputKey=='CloudfrontDistributionId'].OutputValue" --output text)) - terraform -chdir=terraform/envs/prod init + terraform -chdir=terraform/envs/prod init -lockfile=readonly terraform -chdir=terraform/envs/prod apply -auto-approve -var main_cloudfront_distribution_id="$(MAIN_DISTRIBUTION_ID)" make postdeploy @@ -102,7 +102,7 @@ deploy_dev: check_account_dev sam deploy $(common_params) --parameter-overrides $(run_env)=dev $(set_application_prefix)=$(application_key) $(set_application_name)="$(application_name)" S3BucketPrefix="$(s3_bucket_prefix)" @echo "Deploying Terraform..." $(eval MAIN_DISTRIBUTION_ID := $(shell aws cloudformation describe-stacks --stack-name $(application_key) --query "Stacks[0].Outputs[?OutputKey=='CloudfrontDistributionId'].OutputValue" --output text)) - terraform -chdir=terraform/envs/qa init + terraform -chdir=terraform/envs/qa init -lockfile=readonly terraform -chdir=terraform/envs/qa apply -auto-approve -var main_cloudfront_distribution_id="$(MAIN_DISTRIBUTION_ID)" make postdeploy @@ -122,8 +122,8 @@ invalidate_cloudfront: install: yarn -D pip install cfn-lint - terraform -chdir=terraform/envs/qa init - terraform -chdir=terraform/envs/prod init + terraform -chdir=terraform/envs/qa init -lockfile=readonly + terraform -chdir=terraform/envs/prod init -lockfile=readonly test_live_integration: install yarn test:live diff --git a/cloudformation/main.yml b/cloudformation/main.yml index 8c424209..0b4d181a 100644 --- a/cloudformation/main.yml +++ b/cloudformation/main.yml @@ -22,10 +22,6 @@ Parameters: Description: How long the SQS lambda is permitted to run (in seconds) Default: 180 Type: Number - SqsMessageTimeout: - Description: MessageVisibilityTimeout for the SQS Lambda queue (should be at least (numMaxRetry + 1)*SqsLambdaTimeout) - Default: 720 - Type: Number S3BucketPrefix: Description: S3 bucket prefix which will ensure global uniqueness Type: String @@ -86,7 +82,7 @@ Resources: RunEnvironment: !Ref RunEnvironment LambdaFunctionName: !Sub ${ApplicationPrefix}-lambda SesEmailDomain: !FindInMap [General, !Ref RunEnvironment, SesDomain] - SqsQueueArn: !GetAtt AppSQSQueues.Outputs.MainQueueArn + SqsQueueArn: !Sub "arn:aws:sqs:${AWS::Region}:${AWS::AccountId}:infra-core-api-sqs-sales" LinkryKvArn: !GetAtt LinkryRecordsCloudfrontStore.Arn AppLogGroups: @@ -94,14 +90,6 @@ Resources: Properties: Location: ./logs.yml - AppSQSQueues: - Type: AWS::Serverless::Application - Properties: - Location: ./sqs.yml - Parameters: - QueueName: !Sub ${ApplicationPrefix}-sqs - MessageTimeout: !Ref SqsMessageTimeout - LinkryRecordSetv4: Condition: IsDev Type: AWS::Route53::RecordSet @@ -319,7 +307,7 @@ Resources: - AppSqsLambdaFunction Properties: BatchSize: 5 - EventSourceArn: !GetAtt AppSQSQueues.Outputs.MainQueueArn + EventSourceArn: !Sub "arn:aws:sqs:${AWS::Region}:${AWS::AccountId}:infra-core-api-sqs" FunctionName: !Sub ${ApplicationPrefix}-sqs-lambda FunctionResponseTypes: - ReportBatchItemFailures @@ -330,7 +318,7 @@ Resources: - AppSqsLambdaFunction Properties: BatchSize: 5 - EventSourceArn: !GetAtt AppSQSQueues.Outputs.SalesEmailQueueArn + EventSourceArn: !Sub "arn:aws:sqs:${AWS::Region}:${AWS::AccountId}:infra-core-api-sqs-sales" FunctionName: !Sub ${ApplicationPrefix}-sqs-lambda FunctionResponseTypes: - ReportBatchItemFailures @@ -1011,4 +999,4 @@ Outputs: SalesEmailQueueArn: Description: Sales Email Queue Arn - Value: !GetAtt AppSQSQueues.Outputs.SalesEmailQueueArn + Value: !Sub "arn:aws:sqs:${AWS::Region}:${AWS::AccountId}:infra-core-api-sqs-sales" diff --git a/cspell.config.yaml b/cspell.config.yaml index 57ffc007..d44fc9b4 100644 --- a/cspell.config.yaml +++ b/cspell.config.yaml @@ -6,6 +6,7 @@ ignorePaths: dictionaryDefinitions: [] dictionaries: [] words: + - redrive - UIUC ignoreWords: [] import: [] diff --git a/terraform/envs/prod/main.tf b/terraform/envs/prod/main.tf index 1c632218..0e08779d 100644 --- a/terraform/envs/prod/main.tf +++ b/terraform/envs/prod/main.tf @@ -18,10 +18,6 @@ provider "aws" { } } -import { - to = aws_cloudwatch_log_group.main_app_logs - id = "/aws/lambda/${var.ProjectId}-lambda" -} resource "aws_cloudwatch_log_group" "main_app_logs" { name = "/aws/lambda/${var.ProjectId}-lambda" retention_in_days = var.LogRetentionDays @@ -34,3 +30,8 @@ module "app_alarms" { priority_sns_arn = var.GeneralSNSAlertArn standard_sns_arn = var.PrioritySNSAlertArn } + +module "sqs_queues" { + source = "../../modules/sqs" + resource_prefix = var.ProjectId +} diff --git a/terraform/envs/qa/main.tf b/terraform/envs/qa/main.tf index a8a6ed8f..6b0fe5bd 100644 --- a/terraform/envs/qa/main.tf +++ b/terraform/envs/qa/main.tf @@ -21,3 +21,7 @@ resource "aws_cloudwatch_log_group" "main_app_logs" { name = "/aws/lambda/${var.ProjectId}-lambda" retention_in_days = var.LogRetentionDays } +module "sqs_queues" { + source = "../../modules/sqs" + resource_prefix = var.ProjectId +} diff --git a/terraform/modules/sqs/main.tf b/terraform/modules/sqs/main.tf new file mode 100644 index 00000000..9683cd13 --- /dev/null +++ b/terraform/modules/sqs/main.tf @@ -0,0 +1,46 @@ +terraform { + required_providers { + aws = { + source = "hashicorp/aws" + } + } +} + +resource "aws_sqs_queue" "app_dlq" { + name = "${var.resource_prefix}-sqs-dlq" + visibility_timeout_seconds = var.sqs_message_timeout + message_retention_seconds = 1209600 +} + +resource "aws_sqs_queue" "app_queue" { + name = "${var.resource_prefix}-sqs" + visibility_timeout_seconds = var.sqs_message_timeout + redrive_policy = { + deadLetterTargetArn = aws_sqs_queue.app_dlq.arn + maxReceiveCount = 3 + } +} + +resource "aws_sqs_queue" "sales_email_queue" { + name = "${var.resource_prefix}-sqs-sales" + visibility_timeout_seconds = var.sqs_message_timeout + redrive_policy = { + deadLetterTargetArn = aws_sqs_queue.app_dlq.arn + maxReceiveCount = 3 + } +} + +output "main_queue_arn" { + description = "Main Queue Arn" + value = aws_sqs_queue.app_queue.arn +} + +output "dlq_arn" { + description = "Dead-letter Queue Arn" + value = aws_sqs_queue.app_dlq.arn +} + +output "sales_email_queue_arn" { + description = "Sales Email Queue Arn" + value = aws_sqs_queue.sales_email_queue.arn +} diff --git a/terraform/modules/sqs/variables.tf b/terraform/modules/sqs/variables.tf new file mode 100644 index 00000000..3977281c --- /dev/null +++ b/terraform/modules/sqs/variables.tf @@ -0,0 +1,16 @@ +variable "resource_prefix" { + type = string + description = "Prefix before each resource" +} + +variable "sqs_message_timeout" { + type = number + description = "SQS Message timeout in seconds" + default = 720 +} + +variable "dlq_message_retention" { + type = number + description = "DLQ Message retention in seconds" + default = 1209600 +} From 2049ffb26ceacf939dc3ddb0ae4a601ac2804fc8 Mon Sep 17 00:00:00 2001 From: Dev Singh Date: Tue, 22 Jul 2025 11:10:54 -0400 Subject: [PATCH 02/12] remove sqs cloudformation file --- cloudformation/sqs.yml | 59 ------------------------------------------ 1 file changed, 59 deletions(-) delete mode 100644 cloudformation/sqs.yml diff --git a/cloudformation/sqs.yml b/cloudformation/sqs.yml deleted file mode 100644 index c40e7d38..00000000 --- a/cloudformation/sqs.yml +++ /dev/null @@ -1,59 +0,0 @@ -AWSTemplateFormatVersion: '2010-09-09' -Description: Stack SQS Queues -Transform: AWS::Serverless-2016-10-31 -Parameters: - QueueName: - Type: String - AllowedPattern: ^[a-zA-Z0-9]+[a-zA-Z0-9-]+[a-zA-Z0-9]+$ - MessageTimeout: - Type: Number -Resources: - AppDLQ: - Type: AWS::SQS::Queue - Properties: - QueueName: !Sub ${QueueName}-dlq - VisibilityTimeout: !Ref MessageTimeout - MessageRetentionPeriod: 1209600 - - AppQueue: - Type: AWS::SQS::Queue - Properties: - QueueName: !Ref QueueName - VisibilityTimeout: !Ref MessageTimeout - RedrivePolicy: - deadLetterTargetArn: - Fn::GetAtt: - - "AppDLQ" - - "Arn" - maxReceiveCount: 3 - SalesEmailQueue: - Type: AWS::SQS::Queue - Properties: - QueueName: !Sub ${QueueName}-sales - VisibilityTimeout: !Ref MessageTimeout - RedrivePolicy: - deadLetterTargetArn: - Fn::GetAtt: - - "AppDLQ" - - "Arn" - maxReceiveCount: 3 - -Outputs: - MainQueueArn: - Description: Main Queue Arn - Value: - Fn::GetAtt: - - AppQueue - - Arn - DLQArn: - Description: Dead-letter Queue Arn - Value: - Fn::GetAtt: - - AppDLQ - - Arn - SalesEmailQueueArn: - Description: Sales Email Queue Arn - Value: - Fn::GetAtt: - - SalesEmailQueue - - Arn From 54e64c02c54ea27af64fb518b9a1e091f5afd043 Mon Sep 17 00:00:00 2001 From: Dev Singh Date: Tue, 22 Jul 2025 11:24:31 -0400 Subject: [PATCH 03/12] add provider hashes for linux amd64 and arm64 to lockfile --- Makefile | 12 +++++++++--- terraform/envs/prod/.terraform.lock.hcl | 4 ++++ terraform/envs/qa/.terraform.lock.hcl | 4 ++++ 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 3a121516..9cde2738 100644 --- a/Makefile +++ b/Makefile @@ -119,16 +119,18 @@ invalidate_cloudfront: aws cloudfront wait invalidation-completed --distribution-id $(DISTRIBUTION_ID_2) --id $(INVALIDATION_ID_2) @echo "CloudFront invalidation completed!" +init_terraform: + terraform -chdir=terraform/envs/qa init + terraform -chdir=terraform/envs/prod init + install: yarn -D pip install cfn-lint - terraform -chdir=terraform/envs/qa init -lockfile=readonly - terraform -chdir=terraform/envs/prod init -lockfile=readonly test_live_integration: install yarn test:live -test_unit: install +test_unit: install init_terraform yarn lint cfn-lint cloudformation/**/* terraform -chdir=terraform/envs/qa fmt -check @@ -149,3 +151,7 @@ dev_health_check: prod_health_check: curl -f https://core.acm.illinois.edu/api/v1/healthz && curl -f https://core.acm.illinois.edu + +lock_terraform: init_terraform + terraform -chdir=terraform/envs/qa providers lock -platform=windows_amd64 -platform=darwin_amd64 -platform=darwin_arm64 -platform=linux_amd64 -platform=linux_arm64 + terraform -chdir=terraform/envs/prod providers lock -platform=windows_amd64 -platform=darwin_amd64 -platform=darwin_arm64 -platform=linux_amd64 -platform=linux_arm64 diff --git a/terraform/envs/prod/.terraform.lock.hcl b/terraform/envs/prod/.terraform.lock.hcl index 00f630cd..3e2c3752 100644 --- a/terraform/envs/prod/.terraform.lock.hcl +++ b/terraform/envs/prod/.terraform.lock.hcl @@ -5,7 +5,11 @@ provider "registry.terraform.io/hashicorp/aws" { version = "5.100.0" constraints = "~> 5.92" hashes = [ + "h1:H3mU/7URhP0uCRGK8jeQRKxx2XFzEqLiOq/L2Bbiaxs=", "h1:Ijt7pOlB7Tr7maGQIqtsLFbl7pSMIj06TVdkoSBcYOw=", + "h1:edXOJWE4ORX8Fm+dpVpICzMZJat4AX0VRCAy/xkcOc0=", + "h1:hd45qFU5cFuJMpFGdUniU9mVIr5LYVWP1uMeunBpYYs=", + "h1:wOhTPz6apLBuF7/FYZuCoXRK/MLgrNprZ3vXmq83g5k=", "zh:054b8dd49f0549c9a7cc27d159e45327b7b65cf404da5e5a20da154b90b8a644", "zh:0b97bf8d5e03d15d83cc40b0530a1f84b459354939ba6f135a0086c20ebbe6b2", "zh:1589a2266af699cbd5d80737a0fe02e54ec9cf2ca54e7e00ac51c7359056f274", diff --git a/terraform/envs/qa/.terraform.lock.hcl b/terraform/envs/qa/.terraform.lock.hcl index 00f630cd..3e2c3752 100644 --- a/terraform/envs/qa/.terraform.lock.hcl +++ b/terraform/envs/qa/.terraform.lock.hcl @@ -5,7 +5,11 @@ provider "registry.terraform.io/hashicorp/aws" { version = "5.100.0" constraints = "~> 5.92" hashes = [ + "h1:H3mU/7URhP0uCRGK8jeQRKxx2XFzEqLiOq/L2Bbiaxs=", "h1:Ijt7pOlB7Tr7maGQIqtsLFbl7pSMIj06TVdkoSBcYOw=", + "h1:edXOJWE4ORX8Fm+dpVpICzMZJat4AX0VRCAy/xkcOc0=", + "h1:hd45qFU5cFuJMpFGdUniU9mVIr5LYVWP1uMeunBpYYs=", + "h1:wOhTPz6apLBuF7/FYZuCoXRK/MLgrNprZ3vXmq83g5k=", "zh:054b8dd49f0549c9a7cc27d159e45327b7b65cf404da5e5a20da154b90b8a644", "zh:0b97bf8d5e03d15d83cc40b0530a1f84b459354939ba6f135a0086c20ebbe6b2", "zh:1589a2266af699cbd5d80737a0fe02e54ec9cf2ca54e7e00ac51c7359056f274", From 67c220588dd1a0be6abece7d0835b23a5c5b769c Mon Sep 17 00:00:00 2001 From: Dev Singh Date: Tue, 22 Jul 2025 11:28:25 -0400 Subject: [PATCH 04/12] fix redrive policy --- terraform/modules/sqs/main.tf | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/terraform/modules/sqs/main.tf b/terraform/modules/sqs/main.tf index 9683cd13..31215657 100644 --- a/terraform/modules/sqs/main.tf +++ b/terraform/modules/sqs/main.tf @@ -15,19 +15,19 @@ resource "aws_sqs_queue" "app_dlq" { resource "aws_sqs_queue" "app_queue" { name = "${var.resource_prefix}-sqs" visibility_timeout_seconds = var.sqs_message_timeout - redrive_policy = { + redrive_policy = jsonencode({ deadLetterTargetArn = aws_sqs_queue.app_dlq.arn maxReceiveCount = 3 - } + }) } resource "aws_sqs_queue" "sales_email_queue" { name = "${var.resource_prefix}-sqs-sales" visibility_timeout_seconds = var.sqs_message_timeout - redrive_policy = { + redrive_policy = jsonencode({ deadLetterTargetArn = aws_sqs_queue.app_dlq.arn maxReceiveCount = 3 - } + }) } output "main_queue_arn" { From 675896f5208a9b24dc3d21bc2ecafb7810a37d57 Mon Sep 17 00:00:00 2001 From: Dev Singh Date: Tue, 22 Jul 2025 11:56:19 -0400 Subject: [PATCH 05/12] keep state in s3 --- terraform/envs/prod/main.tf | 11 +++++++++++ terraform/envs/qa/main.tf | 7 +++++++ 2 files changed, 18 insertions(+) diff --git a/terraform/envs/prod/main.tf b/terraform/envs/prod/main.tf index 0e08779d..ca9cb829 100644 --- a/terraform/envs/prod/main.tf +++ b/terraform/envs/prod/main.tf @@ -1,3 +1,8 @@ +data "aws_caller_identity" "current" {} +locals { + account_id = data.aws_caller_identity.current.account_id +} + terraform { required_providers { aws = { @@ -7,6 +12,12 @@ terraform { } required_version = ">= 1.2" + backend "s3" { + bucket = "298118738376-terraform" + key = "infra-core-api" + region = "us-east-1" + use_lockfile = true + } } provider "aws" { diff --git a/terraform/envs/qa/main.tf b/terraform/envs/qa/main.tf index 6b0fe5bd..8081becc 100644 --- a/terraform/envs/qa/main.tf +++ b/terraform/envs/qa/main.tf @@ -7,6 +7,13 @@ terraform { } required_version = ">= 1.2" + + backend "s3" { + bucket = "427040638965-terraform" + key = "infra-core-api" + region = "us-east-1" + use_lockfile = true + } } provider "aws" { From a9419a408a7bd37941889e427462087f1247cc8c Mon Sep 17 00:00:00 2001 From: Dev Singh Date: Tue, 22 Jul 2025 11:56:55 -0400 Subject: [PATCH 06/12] add imports back --- terraform/envs/prod/main.tf | 5 ++++- terraform/envs/qa/main.tf | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/terraform/envs/prod/main.tf b/terraform/envs/prod/main.tf index ca9cb829..86ace28f 100644 --- a/terraform/envs/prod/main.tf +++ b/terraform/envs/prod/main.tf @@ -28,7 +28,10 @@ provider "aws" { } } } - +import { + to = aws_cloudwatch_log_group.main_app_logs + id = "/aws/lambda/${var.ProjectId}-lambda" +} resource "aws_cloudwatch_log_group" "main_app_logs" { name = "/aws/lambda/${var.ProjectId}-lambda" retention_in_days = var.LogRetentionDays diff --git a/terraform/envs/qa/main.tf b/terraform/envs/qa/main.tf index 8081becc..2db6396c 100644 --- a/terraform/envs/qa/main.tf +++ b/terraform/envs/qa/main.tf @@ -24,6 +24,10 @@ provider "aws" { } } } +import { + to = aws_cloudwatch_log_group.main_app_logs + id = "/aws/lambda/${var.ProjectId}-lambda" +} resource "aws_cloudwatch_log_group" "main_app_logs" { name = "/aws/lambda/${var.ProjectId}-lambda" retention_in_days = var.LogRetentionDays From 1d9eb12a46e381139123c615e62f21c62848b4a1 Mon Sep 17 00:00:00 2001 From: Dev Singh Date: Tue, 22 Jul 2025 12:03:50 -0400 Subject: [PATCH 07/12] get AWS credentials in test --- .github/workflows/deploy-prod.yml | 6 ++++++ .github/workflows/deploy-qa.yml | 9 ++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy-prod.yml b/.github/workflows/deploy-prod.yml index 335d89df..62bdd2b0 100644 --- a/.github/workflows/deploy-prod.yml +++ b/.github/workflows/deploy-prod.yml @@ -28,6 +28,12 @@ jobs: with: terraform_version: 1.12.2 + - uses: aws-actions/configure-aws-credentials@v4 + with: + role-to-assume: arn:aws:iam::298118738376:role/GitHubActionsRole + role-session-name: Core_Prod_Test_${{ github.run_id }} + aws-region: us-east-1 + - name: Restore Yarn Cache uses: actions/cache@v4 with: diff --git a/.github/workflows/deploy-qa.yml b/.github/workflows/deploy-qa.yml index ab0d2b49..c2f21889 100644 --- a/.github/workflows/deploy-qa.yml +++ b/.github/workflows/deploy-qa.yml @@ -40,6 +40,13 @@ jobs: restore-keys: | yarn-modules-${{ runner.arch }}-${{ runner.os }}- + + - uses: aws-actions/configure-aws-credentials@v4 + with: + role-to-assume: arn:aws:iam::298118738376:role/GitHubActionsRole + role-session-name: Core_QA_Test_${{ github.run_id }} + aws-region: us-east-1 + - name: Run unit testing run: make test_unit @@ -138,7 +145,7 @@ jobs: - uses: aws-actions/configure-aws-credentials@v4 with: role-to-assume: arn:aws:iam::427040638965:role/GitHubActionsRole - role-session-name: Core_Dev_Deployment_${{ github.run_id }} + role-session-name: Core_QA_Deployment_${{ github.run_id }} aws-region: us-east-1 - name: Publish to AWS From ecbf48ce1a2185bdc46490f7a5a6916ba576c087 Mon Sep 17 00:00:00 2001 From: Dev Singh Date: Tue, 22 Jul 2025 12:04:53 -0400 Subject: [PATCH 08/12] Revert "get AWS credentials in test" This reverts commit 1d9eb12a46e381139123c615e62f21c62848b4a1. --- .github/workflows/deploy-prod.yml | 6 ------ .github/workflows/deploy-qa.yml | 9 +-------- 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/.github/workflows/deploy-prod.yml b/.github/workflows/deploy-prod.yml index 62bdd2b0..335d89df 100644 --- a/.github/workflows/deploy-prod.yml +++ b/.github/workflows/deploy-prod.yml @@ -28,12 +28,6 @@ jobs: with: terraform_version: 1.12.2 - - uses: aws-actions/configure-aws-credentials@v4 - with: - role-to-assume: arn:aws:iam::298118738376:role/GitHubActionsRole - role-session-name: Core_Prod_Test_${{ github.run_id }} - aws-region: us-east-1 - - name: Restore Yarn Cache uses: actions/cache@v4 with: diff --git a/.github/workflows/deploy-qa.yml b/.github/workflows/deploy-qa.yml index c2f21889..ab0d2b49 100644 --- a/.github/workflows/deploy-qa.yml +++ b/.github/workflows/deploy-qa.yml @@ -40,13 +40,6 @@ jobs: restore-keys: | yarn-modules-${{ runner.arch }}-${{ runner.os }}- - - - uses: aws-actions/configure-aws-credentials@v4 - with: - role-to-assume: arn:aws:iam::298118738376:role/GitHubActionsRole - role-session-name: Core_QA_Test_${{ github.run_id }} - aws-region: us-east-1 - - name: Run unit testing run: make test_unit @@ -145,7 +138,7 @@ jobs: - uses: aws-actions/configure-aws-credentials@v4 with: role-to-assume: arn:aws:iam::427040638965:role/GitHubActionsRole - role-session-name: Core_QA_Deployment_${{ github.run_id }} + role-session-name: Core_Dev_Deployment_${{ github.run_id }} aws-region: us-east-1 - name: Publish to AWS From 5f6fd9cb24c67adfda09f346ae08385b50c570b0 Mon Sep 17 00:00:00 2001 From: Dev Singh Date: Tue, 22 Jul 2025 12:05:04 -0400 Subject: [PATCH 09/12] remove init from test unit --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 9cde2738..c0a613d0 100644 --- a/Makefile +++ b/Makefile @@ -130,7 +130,7 @@ install: test_live_integration: install yarn test:live -test_unit: install init_terraform +test_unit: install yarn lint cfn-lint cloudformation/**/* terraform -chdir=terraform/envs/qa fmt -check From aac10bf5a682cf11fb348350b46a6b7248eb4626 Mon Sep 17 00:00:00 2001 From: Dev Singh Date: Tue, 22 Jul 2025 12:07:30 -0400 Subject: [PATCH 10/12] init without backend for unit tests --- Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index c0a613d0..039d1bfc 100644 --- a/Makefile +++ b/Makefile @@ -133,9 +133,11 @@ test_live_integration: install test_unit: install yarn lint cfn-lint cloudformation/**/* + terraform -chdir=terraform/envs/qa init -backend=false terraform -chdir=terraform/envs/qa fmt -check - terraform -chdir=terraform/envs/prod fmt -check terraform -chdir=terraform/envs/qa validate + terraform -chdir=terraform/envs/prod init -backend=false + terraform -chdir=terraform/envs/prod fmt -check terraform -chdir=terraform/envs/prod validate yarn prettier yarn test:unit From 620f9bfc297f9043d4da460b7c7af85c8d4deac2 Mon Sep 17 00:00:00 2001 From: Dev Singh Date: Tue, 22 Jul 2025 12:28:01 -0400 Subject: [PATCH 11/12] try 2 --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 039d1bfc..ed31d23a 100644 --- a/Makefile +++ b/Makefile @@ -133,10 +133,10 @@ test_live_integration: install test_unit: install yarn lint cfn-lint cloudformation/**/* - terraform -chdir=terraform/envs/qa init -backend=false + terraform -chdir=terraform/envs/qa init -reconfigure -backend=false -upgrade terraform -chdir=terraform/envs/qa fmt -check terraform -chdir=terraform/envs/qa validate - terraform -chdir=terraform/envs/prod init -backend=false + terraform -chdir=terraform/envs/prod init -reconfigure -backend=false terraform -chdir=terraform/envs/prod fmt -check terraform -chdir=terraform/envs/prod validate yarn prettier From 6fc241b75c64583bb753bede355884142ef1d9bf Mon Sep 17 00:00:00 2001 From: Dev Singh Date: Tue, 22 Jul 2025 17:02:14 -0400 Subject: [PATCH 12/12] fix queue arn --- cloudformation/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloudformation/main.yml b/cloudformation/main.yml index 0b4d181a..5ecaa07e 100644 --- a/cloudformation/main.yml +++ b/cloudformation/main.yml @@ -82,7 +82,7 @@ Resources: RunEnvironment: !Ref RunEnvironment LambdaFunctionName: !Sub ${ApplicationPrefix}-lambda SesEmailDomain: !FindInMap [General, !Ref RunEnvironment, SesDomain] - SqsQueueArn: !Sub "arn:aws:sqs:${AWS::Region}:${AWS::AccountId}:infra-core-api-sqs-sales" + SqsQueueArn: !Sub "arn:aws:sqs:${AWS::Region}:${AWS::AccountId}:infra-core-api-sqs" LinkryKvArn: !GetAtt LinkryRecordsCloudfrontStore.Arn AppLogGroups: