Skip to content

Commit

Permalink
Create the queue in Serverless instead of terraform
Browse files Browse the repository at this point in the history
  • Loading branch information
aloftus23 committed Oct 4, 2023
1 parent 6df8f35 commit 3f3316a
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 41 deletions.
2 changes: 0 additions & 2 deletions backend/env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ 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_ARN: ${ssm:/crossfeed/staging/SQS_QUEUE_ARN}
CLOUDWATCH_BUCKET_NAME: cisa-crossfeed-staging-cloudwatch

prod:
Expand Down Expand Up @@ -78,7 +77,6 @@ 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_ARN: ${ssm:/crossfeed/prod/SQS_QUEUE_ARN}
CLOUDWATCH_BUCKET_NAME: cisa-crossfeed-prod-cloudwatch

dev-vpc:
Expand Down
7 changes: 7 additions & 0 deletions backend/serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,13 @@ provider:
- logs:StopLiveTail
Resource: '*'

resources:
Resources:
MySQSQueue:
Type: AWS::SQS::Queue
Properties:
QueueName: ${self:provider.stage}-worker-queue

functions:
- ${file(./src/tasks/functions.yml)}
- ${file(./src/api/functions.yml)}
Expand Down
4 changes: 3 additions & 1 deletion backend/src/tasks/functions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ scanExecution:
events:
- sqs:
arn:
Fn::ImportValue: ${file(env.yml):${self:provider.stage}.SQS_QUEUE_ARN, ''}
Fn::GetAtt:
- ${self:provider.stage}-worker-queue
- Arn
batchSize: 5 # Number of messages the lambda can continue to process while a Fargate is still running

updateScanTaskStatus:
Expand Down
2 changes: 0 additions & 2 deletions infrastructure/prod.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,3 @@ create_db_accessor_instance = true
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"
21 changes: 0 additions & 21 deletions infrastructure/sqs.tf

This file was deleted.

2 changes: 0 additions & 2 deletions infrastructure/stage.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,3 @@ create_db_accessor_instance = true
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"
13 changes: 0 additions & 13 deletions infrastructure/vars.tf
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,6 @@ 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 @@ -435,10 +429,3 @@ variable "create_elk_instance" {
type = bool
default = false
}

variable "sqs_queue_name" {
description = "sqs_queue_name"
type = string
default = "crossfeed-staging-worker-queue"
}

0 comments on commit 3f3316a

Please sign in to comment.