Skip to content

Add message group ID #228

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Aug 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/deploy-qa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,11 @@ 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
run: make deploy_dev
run: make deploy_qa
env:
HUSKY: "0"
VITE_RUN_ENVIRONMENT: dev
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,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
role-session-name: Core_QA_Deployment
aws-region: us-east-1

- name: Get AWS Caller Identity
Expand Down
22 changes: 8 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,6 @@ GIT_HASH := $(shell git rev-parse --short HEAD)

.PHONY: clean

check_account_prod:
ifneq ($(current_aws_account),$(prod_aws_account))
$(error Error: running in account $(current_aws_account), expected account ID $(prod_aws_account))
endif

check_account_dev:
ifneq ($(current_aws_account),$(dev_aws_account))
$(error Error: running in account $(current_aws_account), expected account ID $(dev_aws_account))
endif


clean:
rm -rf .aws-sam
Expand Down Expand Up @@ -55,15 +45,19 @@ build: src/
local:
VITE_BUILD_HASH=$(GIT_HASH) yarn run dev

deploy_prod: check_account_prod
deploy_prod:
@echo "Deploying Terraform..."
terraform -chdir=terraform/envs/prod init -lockfile=readonly
terraform -chdir=terraform/envs/prod apply -auto-approve
terraform -chdir=terraform/envs/prod plan -out=tfplan
terraform -chdir=terraform/envs/prod apply -auto-approve tfplan
rm terraform/envs/prod/tfplan

deploy_dev: check_account_dev
deploy_qa:
@echo "Deploying Terraform..."
terraform -chdir=terraform/envs/qa init -lockfile=readonly
terraform -chdir=terraform/envs/qa apply -auto-approve
terraform -chdir=terraform/envs/qa plan -out=tfplan
terraform -chdir=terraform/envs/qa apply -auto-approve tfplan
rm terraform/envs/qa/tfplan

init_terraform:
terraform -chdir=terraform/envs/qa init
Expand Down
3 changes: 1 addition & 2 deletions src/api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
2. Enable Tailscale VPN so you can reach the development database in AWS
3. Log into AWS with `aws configure sso` so you can retrieve the AWS secret and configuration.
4. `yarn -D`
5. `make check_account_dev` - If this fails make sure that AWS is configured.
6. `make local`

## Build for AWS Lambda
Expand All @@ -16,7 +15,7 @@

1. Get AWS credentials with `aws configure sso`
2. Ensure AWS profile is set to the right account (QA or PROD).
3. Run `make deploy_dev` or `make deploy_prod`.
3. Run `make deploy_qa` or `make deploy_prod`.

## Generating JWT token

Expand Down
2 changes: 2 additions & 0 deletions src/api/routes/apiKey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ If you did not create this API key, please secure your account and notify the AC
new SendMessageCommand({
QueueUrl: fastify.environmentConfig.SqsQueueUrl,
MessageBody: JSON.stringify(sqsPayload),
MessageGroupId: "securityNotification",
}),
);
if (result.MessageId) {
Expand Down Expand Up @@ -228,6 +229,7 @@ If you did not delete this API key, please secure your account and notify the AC
new SendMessageCommand({
QueueUrl: fastify.environmentConfig.SqsQueueUrl,
MessageBody: JSON.stringify(sqsPayload),
MessageGroupId: "securityNotification",
}),
);
if (result.MessageId) {
Expand Down
1 change: 1 addition & 0 deletions src/api/routes/membership.ts
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,7 @@ const membershipPlugin: FastifyPluginAsync = async (fastify, _options) => {
new SendMessageCommand({
QueueUrl: fastify.environmentConfig.SqsQueueUrl,
MessageBody: JSON.stringify(sqsPayload),
MessageGroupId: "membershipProvisioning",
}),
);
if (!result.MessageId) {
Expand Down
1 change: 1 addition & 0 deletions src/api/routes/mobileWallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ const mobileWalletRoute: FastifyPluginAsync = async (fastify, _options) => {
new SendMessageCommand({
QueueUrl: fastify.environmentConfig.SqsQueueUrl,
MessageBody: JSON.stringify(sqsPayload),
MessageGroupId: "mobileWalletNotification",
}),
);
if (!result.MessageId) {
Expand Down
2 changes: 2 additions & 0 deletions src/api/routes/roomRequests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ const roomRequestRoutes: FastifyPluginAsync = async (fastify, _options) => {
new SendMessageCommand({
QueueUrl: fastify.environmentConfig.SqsQueueUrl,
MessageBody: JSON.stringify(sqsPayload),
MessageGroupId: "roomReservationNotification",
}),
);
if (!result.MessageId) {
Expand Down Expand Up @@ -388,6 +389,7 @@ const roomRequestRoutes: FastifyPluginAsync = async (fastify, _options) => {
new SendMessageCommand({
QueueUrl: fastify.environmentConfig.SqsQueueUrl,
MessageBody: JSON.stringify(sqsPayload),
MessageGroupId: "roomReservationNotification",
}),
);
if (!result.MessageId) {
Expand Down
3 changes: 3 additions & 0 deletions src/api/routes/stripe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,7 @@ Please ask the payee to try again, perhaps with a different payment method, or c
new SendMessageCommand({
QueueUrl: fastify.environmentConfig.SqsQueueUrl,
MessageBody: JSON.stringify(sqsPayload),
MessageGroupId: "invoiceNotification",
}),
);
queueId = result.MessageId || "";
Expand Down Expand Up @@ -588,6 +589,7 @@ Please contact Officer Board with any questions.
new SendMessageCommand({
QueueUrl: fastify.environmentConfig.SqsQueueUrl,
MessageBody: JSON.stringify(sqsPayload),
MessageGroupId: "invoiceNotification",
}),
);
queueId = result.MessageId || "";
Expand Down Expand Up @@ -636,6 +638,7 @@ Please contact Officer Board with any questions.`,
new SendMessageCommand({
QueueUrl: fastify.environmentConfig.SqsQueueUrl,
MessageBody: JSON.stringify(sqsPayload),
MessageGroupId: "invoiceNotification",
}),
);
queueId = result.MessageId || "";
Expand Down
42 changes: 21 additions & 21 deletions terraform/envs/prod/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 10 additions & 5 deletions terraform/envs/prod/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 5.92"
version = "~> 6.7.0"
}
}

Expand All @@ -18,7 +18,8 @@ terraform {


provider "aws" {
region = "us-east-1"
allowed_account_ids = ["298118738376"]
region = "us-east-1"
default_tags {
tags = {
project = var.ProjectId
Expand All @@ -31,7 +32,11 @@ data "aws_caller_identity" "current" {}
data "aws_region" "current" {}

locals {
bucket_prefix = "${data.aws_caller_identity.current.account_id}-${data.aws_region.current.name}"
bucket_prefix = "${data.aws_caller_identity.current.account_id}-${data.aws_region.current.region}"
queue_arns = {
main = module.sqs_queues.main_queue_arn
sqs = module.sqs_queues.sales_email_queue_arn
}
}

module "sqs_queues" {
Expand All @@ -41,7 +46,7 @@ module "sqs_queues" {
}

module "lambda_warmer" {
source = "github.com/acm-uiuc/terraform-modules/lambda-warmer?ref=v0.1.1"
source = "github.com/acm-uiuc/terraform-modules/lambda-warmer?ref=v1.0.0"
function_to_warm = module.lambdas.core_api_lambda_name
}
module "dynamo" {
Expand Down Expand Up @@ -95,7 +100,7 @@ module "frontend" {

resource "aws_lambda_event_source_mapping" "queue_consumer" {
depends_on = [module.lambdas, module.sqs_queues]
for_each = toset([module.sqs_queues.main_queue_arn, module.sqs_queues.sales_email_queue_arn])
for_each = local.queue_arns
batch_size = 5
event_source_arn = each.key
function_name = module.lambdas.core_sqs_consumer_lambda_arn
Expand Down
42 changes: 21 additions & 21 deletions terraform/envs/qa/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 13 additions & 7 deletions terraform/envs/qa/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 5.92"
version = "~> 6.7.0"
}
}

Expand All @@ -18,7 +18,8 @@ terraform {


provider "aws" {
region = "us-east-1"
allowed_account_ids = ["427040638965"]
region = "us-east-1"
default_tags {
tags = {
project = var.ProjectId
Expand All @@ -30,16 +31,21 @@ provider "aws" {
data "aws_caller_identity" "current" {}
data "aws_region" "current" {}

locals {
bucket_prefix = "${data.aws_caller_identity.current.account_id}-${data.aws_region.current.name}"
}

module "sqs_queues" {
depends_on = [module.lambdas]
source = "../../modules/sqs"
resource_prefix = var.ProjectId
core_sqs_consumer_lambda_name = module.lambdas.core_sqs_consumer_lambda_name
}
locals {
bucket_prefix = "${data.aws_caller_identity.current.account_id}-${data.aws_region.current.region}"
queue_arns = {
main = module.sqs_queues.main_queue_arn
sqs = module.sqs_queues.sales_email_queue_arn
}
}


module "lambda_warmer" {
source = "github.com/acm-uiuc/terraform-modules/lambda-warmer?ref=v0.1.1"
Expand Down Expand Up @@ -122,9 +128,9 @@ resource "aws_route53_record" "linkry" {
}
resource "aws_lambda_event_source_mapping" "queue_consumer" {
depends_on = [module.lambdas, module.sqs_queues]
for_each = toset([module.sqs_queues.main_queue_arn, module.sqs_queues.sales_email_queue_arn])
for_each = local.queue_arns
batch_size = 5
event_source_arn = each.key
event_source_arn = each.value
function_name = module.lambdas.core_sqs_consumer_lambda_arn
function_response_types = ["ReportBatchItemFailures"]
}
Expand Down
Loading
Loading