From 3c6229477d8ceda48667ee20709d75487cfae91c Mon Sep 17 00:00:00 2001 From: Santiago Lo Coco Date: Mon, 5 Dec 2022 17:51:57 -0300 Subject: [PATCH] Fix bugs and update lambda Co-authored-by: Ezequiel Bellver --- terraform/organization/datasources.tf | 4 +- terraform/organization/dynamodb.tf | 7 +- terraform/organization/html/index.html | 98 +++++++++++++++++- terraform/resources/lambda/lambdaDB.zip | Bin 521 -> 653 bytes .../lambda/lambdaDB/lambda_handler.py | 12 ++- terraform/resources/lambda/lambdaError.zip | Bin 559 -> 559 bytes terraform/resources/lambda/lambdaGET.zip | Bin 321 -> 321 bytes terraform/resources/lambda/lambdaRemove.zip | Bin 496 -> 509 bytes .../lambda/lambdaRemove/lambda_handler.py | 3 +- terraform/resources/lambda/lambdaSNS.zip | Bin 393 -> 393 bytes terraform/resources/lambda/lambdaSQS.zip | Bin 519 -> 519 bytes terraform/resources/lambda/lambdaUpdate.zip | Bin 414 -> 414 bytes .../resources/lambda/lambdaUpdateAPI.zip | Bin 483 -> 483 bytes 13 files changed, 116 insertions(+), 8 deletions(-) diff --git a/terraform/organization/datasources.tf b/terraform/organization/datasources.tf index 3379531..12683c1 100644 --- a/terraform/organization/datasources.tf +++ b/terraform/organization/datasources.tf @@ -14,6 +14,7 @@ data "template_file" "userdata" { template = file("${path.module}/html/index.html") vars = { ENDPOINT = "${module.apigw.endpoint}" + token = "" } } @@ -25,7 +26,8 @@ data "aws_iam_policy_document" "dynamodb" { "dynamodb:Scan", "dynamodb:GetItem", "dynamodb:UpdateItem", - "dynamodb:DeleteItem" + "dynamodb:DeleteItem", + "dynamodb:Query", ] principals { type = "AWS" diff --git a/terraform/organization/dynamodb.tf b/terraform/organization/dynamodb.tf index ef75666..661e4e8 100644 --- a/terraform/organization/dynamodb.tf +++ b/terraform/organization/dynamodb.tf @@ -9,9 +9,14 @@ module "dynamodb" { billing_mode = "PROVISIONED" read_capacity = 20 write_capacity = 20 - hash_key = "id" + hash_key = "username" + range_key = "id" attributes = [ + { + name = "username" + type = "S" + }, { name = "id" type = "N" diff --git a/terraform/organization/html/index.html b/terraform/organization/html/index.html index 5634c1e..a0a8410 100644 --- a/terraform/organization/html/index.html +++ b/terraform/organization/html/index.html @@ -5,7 +5,9 @@ BSMSapp
+ +


@@ -13,7 +15,9 @@

BSMSapp

-
+ + +
  • @@ -30,7 +34,7 @@
- +

@@ -39,6 +43,44 @@