Skip to content

Commit

Permalink
Fix SQS in serverless deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
aloftus23 committed Oct 4, 2023
1 parent da40df3 commit c1794f4
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 28 deletions.
4 changes: 2 additions & 2 deletions backend/env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ staging:
EXPORT_BUCKET_NAME: cisa-crossfeed-staging-exports
PE_API_URL: ${ssm:/crossfeed/staging/PE_API_URL}
REPORTS_BUCKET_NAME: cisa-crossfeed-staging-reports
SQS_QUEUE_NAME: crossfeed-staging-worker-queue
SQS_QUEUE_ARN: ${ssm:/crossfeed/staging/SQS_QUEUE_ARN}
CLOUDWATCH_BUCKET_NAME: cisa-crossfeed-staging-cloudwatch

prod:
Expand Down Expand Up @@ -78,7 +78,7 @@ prod:
EXPORT_BUCKET_NAME: cisa-crossfeed-prod-exports
PE_API_URL: ${ssm:/crossfeed/staging/PE_API_URL}
REPORTS_BUCKET_NAME: cisa-crossfeed-prod-reports
SQS_QUEUE_NAME: crossfeed-prod-worker-queue
SQS_QUEUE_ARN: ${ssm:/crossfeed/prod/SQS_QUEUE_ARN}
CLOUDWATCH_BUCKET_NAME: cisa-crossfeed-prod-cloudwatch

dev-vpc:
Expand Down
3 changes: 1 addition & 2 deletions backend/src/tasks/functions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ scanExecution:
- sqs:
arn:
Fn::GetAtt:
- ${file(env.yml):${self:provider.stage}.SQS_QUEUE_NAME, ''}
- Arn
- ${self:custom.sqsEnvVar}.${self:provider.stage}.SQS_QUEUE_ARN
batchSize: 5 # Number of messages the lambda can continue to process while a Fargate is still running

updateScanTaskStatus:
Expand Down
4 changes: 1 addition & 3 deletions infrastructure/prod.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,9 @@ worker_ecs_task_definition_family = "crossfeed-prod-worker"
worker_ecs_log_group_name = "crossfeed-prod-worker"
worker_ecs_role_name = "crossfeed-prod-worker"
logging_bucket_name = "cisa-crossfeed-prod-logging"
cloudtrail_name = "crossfeed-prod-all-events"
cloudtrail_bucket_name = "cisa-crossfeed-prod-cloudtrail"
cloudtrail_role_name = "cisa-crossfeed-prod-cloudtrail"
cloudtrail_log_group_name = "cisa-crossfeed-prod-cloudtrail"
cloudwatch_bucket_name = "cisa-crossfeed-prod-cloudwatch"
cloudwatch_log_group_name = "crossfeed-prod-cloudwatch-bucket"
export_bucket_name = "cisa-crossfeed-prod-exports"
reports_bucket_name = "cisa-crossfeed-prod-reports"
pe_db_backups_bucket_name = "cisa-crossfeed-prod-pe-db-backups"
Expand All @@ -71,3 +68,4 @@ db_accessor_instance_class = "t3.2xlarge"
create_elk_instance = false
elk_instance_class = "t3.2xlarge"
sqs_queue_name = "crossfeed-prod-worker-queue"
ssm_sqs_queue_arn = "/crossfeed/prod/SQS_QUEUE_ARN"
7 changes: 7 additions & 0 deletions infrastructure/sqs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,11 @@ resource "aws_sqs_queue" "terraform_queue" {
Project = var.project
Stage = var.stage
}
}

resource "aws_ssm_parameter" "sqs_queue_arn" {
name = var.ssm_sqs_queue_arn
description = "ARN of the SQS queue"
type = "String"
value = aws_sqs_queue.terraform_queue.arn
}
4 changes: 1 addition & 3 deletions infrastructure/stage.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,9 @@ worker_ecs_task_definition_family = "crossfeed-staging-worker"
worker_ecs_log_group_name = "crossfeed-staging-worker"
worker_ecs_role_name = "crossfeed-staging-worker"
logging_bucket_name = "cisa-crossfeed-staging-logging"
cloudtrail_name = "crossfeed-staging-all-events"
cloudtrail_bucket_name = "cisa-crossfeed-staging-cloudtrail"
cloudtrail_role_name = "cisa-crossfeed-staging-cloudtrail"
cloudtrail_log_group_name = "cisa-crossfeed-staging-cloudtrail"
cloudwatch_bucket_name = "cisa-crossfeed-staging-cloudwatch"
cloudwatch_log_group_name = "crossfeed-staging-cloudwatch-bucket"
export_bucket_name = "cisa-crossfeed-staging-exports"
reports_bucket_name = "cisa-crossfeed-staging-reports"
pe_db_backups_bucket_name = "cisa-crossfeed-staging-pe-db-backups"
Expand All @@ -71,3 +68,4 @@ db_accessor_instance_class = "t3.2xlarge"
create_elk_instance = true
elk_instance_class = "t3.2xlarge"
sqs_queue_name = "crossfeed-staging-worker-queue"
ssm_sqs_queue_arn = "/crossfeed/staging/SQS_QUEUE_ARN"
24 changes: 6 additions & 18 deletions infrastructure/vars.tf
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,12 @@ variable "ssm_worker_subnet" {
default = "/crossfeed/staging/WORKER_SUBNET_ID"
}

variable "ssm_sqs_queue_arn" {
description = "ssm_sqs_queue_arn"
type = string
default = "/crossfeed/staging/SQS_QUEUE_ARN"
}

variable "ssm_worker_arn" {
description = "ssm_worker_arn"
type = string
Expand Down Expand Up @@ -262,12 +268,6 @@ variable "logging_bucket_name" {
default = "cisa-crossfeed-staging-logging"
}

variable "cloudtrail_name" {
description = "cloudtrail_name"
type = string
default = "crossfeed-staging-all-events"
}

variable "cloudtrail_bucket_name" {
description = "cloudtrail_bucket_name"
type = string
Expand All @@ -286,18 +286,6 @@ variable "cloudtrail_log_group_name" {
default = "crossfeed-staging-cloudtrail-logs"
}

variable "cloudwatch_bucket_name" {
description = "cloudwatch_bucket_name"
type = string
default = "cisa-crossfeed-staging-cloudwatch"
}

variable "cloudwatch_log_group_name" {
description = "cloudwatch_log_group_name"
type = string
default = "crossfeed-staging-cloudwatch-bucket"
}

variable "export_bucket_name" {
description = "export_bucket_name"
type = string
Expand Down

0 comments on commit c1794f4

Please sign in to comment.