-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
362 additions
and
137 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,27 @@ | ||
# terraform-computing | ||
|
||
[![Terraform Apply](https://github.com/soat-tech-challenge/terraform-computing/actions/workflows/main.yml/badge.svg)](https://github.com/soat-tech-challenge/terraform-computing/actions/workflows/main.yml) | ||
|
||
Part of a group course project of a self service and kitchen management system for a fictional fast food restaurant. | ||
|
||
Currently responsible for managing computing-related resources of the project. | ||
|
||
### Service | ||
|
||
#### ECS Exec | ||
|
||
Requires: AWS CLI, Session Manager plugin | ||
|
||
Enter ECS task container shell using ECS Exec: | ||
|
||
``` | ||
aws ecs execute-command \ | ||
--region us-east-1 \ | ||
--cluster SOAT_Tech_Challenge_ECS_Cluster \ | ||
--task task-id \ | ||
--container SOAT-TC_ECS_<service>_SVC_Main_Container \ | ||
--interactive \ | ||
--command "/usr/bin/sh" | ||
``` | ||
|
||
Read more: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-exec.html#ecs-exec-enabling-and-using |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
locals { | ||
api_id = data.tfe_outputs.network.values.api_gw_gateway_api.id | ||
proxy_to_alb_id = data.tfe_outputs.network.values.api_gw_integration_proxy_to_alb.id | ||
} | ||
|
||
// ----- Authorizers ----- | ||
|
||
resource "aws_apigatewayv2_authorizer" "lambda_authorizer_client" { | ||
api_id = local.api_id | ||
authorizer_type = "REQUEST" | ||
authorizer_uri = aws_lambda_function.authorizer_client.invoke_arn | ||
identity_sources = ["$request.header.Authorization"] | ||
name = "SOAT-TC_API_Gateway_Authorizer__Lambda_Authorizer_Client" | ||
|
||
authorizer_payload_format_version = "2.0" | ||
enable_simple_responses = true | ||
} | ||
|
||
// ----- Integrations ----- | ||
|
||
resource "aws_apigatewayv2_integration" "lambda_identification_nationalid" { | ||
api_id = local.api_id | ||
integration_type = "AWS_PROXY" | ||
|
||
description = "Intercept identification request for token generation flow" | ||
integration_method = "POST" | ||
integration_uri = aws_lambda_function.identification_nationalid.invoke_arn | ||
|
||
payload_format_version = "2.0" | ||
} | ||
|
||
// ----- Routes ----- | ||
// Routes should be declared on terraform-network whenever possible. The routes below | ||
// depend on terraform-computing resources, they are declared here to avoid cyclic dependencies. | ||
|
||
resource "aws_apigatewayv2_route" "client_identification" { | ||
api_id = local.api_id | ||
route_key = "POST /identification/clients/identification" | ||
|
||
target = "integrations/${aws_apigatewayv2_integration.lambda_identification_nationalid.id}" | ||
} | ||
|
||
resource "aws_apigatewayv2_route" "order_checkout_and_listing" { | ||
api_id = local.api_id | ||
route_key = "ANY /order/orders" // due to Servlet Filter urlPatterns not supporting specific HTTP methods | ||
|
||
authorizer_id = aws_apigatewayv2_authorizer.lambda_authorizer_client.id | ||
authorization_type = "CUSTOM" | ||
target = "integrations/${local.proxy_to_alb_id}" | ||
} | ||
|
||
resource "aws_apigatewayv2_route" "order_confirmation" { | ||
api_id = local.api_id | ||
route_key = "POST /payment/payments/initialize" | ||
|
||
authorizer_id = aws_apigatewayv2_authorizer.lambda_authorizer_client.id | ||
authorization_type = "CUSTOM" | ||
target = "integrations/${local.proxy_to_alb_id}" | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#tfsec:ignore:aws-cloudwatch-log-group-customer-key | ||
resource "aws_cloudwatch_log_group" "lambda_authorizer_client" { | ||
name = "/aws/lambda/SOAT-TC_Lambda_Authorizer_Client_Logs" | ||
retention_in_days = 30 | ||
|
||
tags = { | ||
Name : "SOAT-TC Lambda Authorizer Client Cloudwatch Log Group" | ||
} | ||
} | ||
|
||
#tfsec:ignore:aws-cloudwatch-log-group-customer-key | ||
resource "aws_cloudwatch_log_group" "lambda_identification_nationalid" { | ||
name = "/aws/lambda/SOAT-TC_Lambda_Identification_NationalID_Logs" | ||
retention_in_days = 30 | ||
|
||
tags = { | ||
Name : "SOAT-TC Lambda Identification National ID Cloudwatch Log Group" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.