Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
craigzour committed Apr 4, 2024
1 parent 9cb8f91 commit adbb88f
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 12 deletions.
9 changes: 5 additions & 4 deletions aws/ecr/ecr.tf
Original file line number Diff line number Diff line change
Expand Up @@ -412,17 +412,18 @@ resource "aws_ecr_lifecycle_policy" "cognito_pre_sign_up_lambda" {
#
resource "aws_ecr_repository" "load_test_repository" {
count = var.env == "staging" ? 1 : 0
name = "load_test"
image_tag_mutability = "MUTABLE"

name = "load-testing"
image_tag_mutability = "IMMUTABLE"
image_scanning_configuration {
scan_on_push = true
}
}

resource "aws_ecr_lifecycle_policy" "load_test_policy" {
count = var.env == "staging" ? 1 : 0
repository = aws_ecr_repository.load_test_repository[0].name
repository = aws_ecr_repository.load_test_repository.name

policy = jsonencode({
rules = [{
rulePriority = 1
Expand Down
8 changes: 3 additions & 5 deletions aws/load_testing/lambda.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@
# Load testing
#


resource "aws_lambda_function" "load_testing" {
image_uri = "${var.ecr_repository_url_load_test}:latest"
function_name = "LoadTesting"
function_name = "load-testing"
role = aws_iam_role.load_test_lambda.arn
timeout = 300
memory_size = 200
Expand All @@ -31,11 +30,10 @@ resource "aws_lambda_function" "load_testing" {
#
# IAM: Load testing
#

resource "aws_iam_role" "load_test_lambda" {
name = "LoadTestLambda"
assume_role_policy = data.aws_iam_policy_document.lambda_assume_policy.json


}

data "aws_iam_policy_document" "lambda_assume_policy" {
Expand All @@ -54,4 +52,4 @@ data "aws_iam_policy_document" "lambda_assume_policy" {
resource "aws_iam_role_policy_attachment" "load_test_lambda_basic_access" {
role = aws_iam_role.load_test_lambda.name
policy_arn = "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
}
}
2 changes: 1 addition & 1 deletion lambda-code/deploy-lambda-images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ redColor='\033[0;31m'
reset='\033[0m' # No Color

ecrRepositoryAddress=000000000000.dkr.ecr.ca-central-1.localhost.localstack.cloud:4511
lambdasToSkip=("cognito-email-sender", "cognito-pre-sign-up", "notify-slack")
lambdasToSkip=("cognito-email-sender", "cognito-pre-sign-up", "notify-slack", "load-testing")
basedir=$(pwd)

if ! command -v awslocal > /dev/null; then
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM amazon/aws-lambda-python:3.11@sha256:99cadc3bd9674a32a4ef694ff2e27f0b3d6c7f369b174db792b0099699fa0da4
COPY lambda_locust.py .
COPY main.py .
COPY tests ./tests
COPY requirements.txt .

Expand All @@ -9,4 +9,4 @@ RUN pip3 install --upgrade pip

RUN pip3 install -r requirements.txt

CMD ["lambda_locust.handler"]
CMD ["main.handler"]
File renamed without changes.
File renamed without changes.

0 comments on commit adbb88f

Please sign in to comment.