diff --git a/README.md b/README.md index 3df869f..5dfc340 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Construye una API REST que puede recibir requests POST, GET u OPTIONS. En el cas ### CloudFront -Realiza caché de la API y del S3 (que hostea el sitio estático). +Funciona como CDN y realiza caché de la API y del S3 (que hostea el sitio estático). ### Dynamo DB @@ -34,7 +34,7 @@ Este módulo es [externo](https://registry.terraform.io/modules/terraform-aws-mo ### WAF -Protege la aplicación mediante 3 rules. Esto lo hace mediante la creación de un web ACL asociado a la distribución de cloudfront. +Protege la aplicación mediante 3 rules. Esto lo hace mediante la creación de un web ACL asociado a la distribución de CloudFront. ## Descripción y referencia de funciones y meta-argumentos @@ -66,12 +66,12 @@ Junto a cada función se especifica para qué se usa. + [modules/s3/main.tf](terraform/modules/s3/main.tf#L38) + [organization/cloudfront.tf](terraform/organization/cloudfront.tf#L13) -- **trimsuffix**: remueve substring del final de un string. - + [modules/s3/main.tf](terraform/modules/s3/main.tf#L19) - - **sha1**: computa el `SHA1` del string de la configuración del apigw para saber si se necesita forzar el redeploy del módulo. + [modules/apigw/main.tf](terraform/modules/apigw/main.tf#L103) +- **trimsuffix**: remueve substring del final de un string. + + [modules/s3/main.tf](terraform/modules/s3/main.tf#L19) + - **try**: en caso de que no haya objetos, se utiliza un objeto vacío. + [modules/s3/main.tf](terraform/modules/s3/main.tf#L35) + [organization/s3.tf](terraform/organization/s3.tf#L10) diff --git a/docs/architecture.png b/docs/architecture.png index 22dadb7..74855df 100644 Binary files a/docs/architecture.png and b/docs/architecture.png differ diff --git a/terraform/modules/dynamodb/outputs.tf b/terraform/modules/dynamodb/outputs.tf index f18369e..c51f228 100644 --- a/terraform/modules/dynamodb/outputs.tf +++ b/terraform/modules/dynamodb/outputs.tf @@ -1,3 +1,8 @@ # -------------------------------------------------------------------- # DynamoDB outputs # -------------------------------------------------------------------- + +output "name" { + description = "The name of the table." + value = aws_dynamodb_table.this.name +} diff --git a/terraform/organization/datasources.tf b/terraform/organization/datasources.tf index 60cfc70..ede3abd 100644 --- a/terraform/organization/datasources.tf +++ b/terraform/organization/datasources.tf @@ -30,6 +30,6 @@ data "aws_iam_policy_document" "this" { type = "AWS" identifiers = ["*"] } - resources = ["arn:aws:dynamodb:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:table/AWSDynamoDB-g3"] + resources = ["arn:aws:dynamodb:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:table/${module.dynamodb.name}"] } } diff --git a/terraform/organization/locals.tf b/terraform/organization/locals.tf index 153dd7c..8a86ce0 100644 --- a/terraform/organization/locals.tf +++ b/terraform/organization/locals.tf @@ -53,14 +53,14 @@ locals { lambdas = { lambdaSQS = { package = "${local.path}/lambda/lambdaSQS.zip" - function_name = "AWSLambdaHandlerAPISQSDBg3test" + function_name = "AWSLambdaHandlerAPISQSDBg3" role = "arn:aws:iam::${data.aws_caller_identity.current.account_id}:role/LabRole" handler = "lambda_handler.main" runtime = "python3.9" }, lambdaDB = { package = "${local.path}/lambda/lambdaDB.zip" - function_name = "AWSLambdaHandlerAPIDBg3test" + function_name = "AWSLambdaHandlerAPIDBg3" role = "arn:aws:iam::${data.aws_caller_identity.current.account_id}:role/LabRole" handler = "lambda_handler.main" runtime = "python3.9" diff --git a/terraform/organization/vpc.tf b/terraform/organization/vpc.tf index 1baa3e1..a1e91b2 100644 --- a/terraform/organization/vpc.tf +++ b/terraform/organization/vpc.tf @@ -45,6 +45,10 @@ module "vpc" { module "vpc_endpoints" { source = "terraform-aws-modules/vpc/aws//modules/vpc-endpoints" + depends_on = [ + module.dynamodb + ] + vpc_id = module.vpc.vpc_id security_group_ids = [data.aws_security_group.default.id]