Skip to content

Commit c0e3291

Browse files
committed
CCM-7249: Squashed commit of the following:
commit 8a4980f82ffb896418c81ed6eb3fae8613ea3ca4 Merge: 5705d61 7a7be81 Author: Michael Harrison <[email protected]> Date: Tue Nov 19 13:08:31 2024 +0000 Merge branch 'main' into feature/CCM-7249_template-api-skeleton commit 5705d61 Author: Michael Harrison <[email protected]> Date: Tue Nov 19 12:57:04 2024 +0000 CCM-7249: signed commit? commit 1633b9f Author: Michael Harrison <[email protected]> Date: Tue Nov 19 12:54:02 2024 +0000 CCM-7249: test signed commit commit 68be842 Author: Michael Harrison <[email protected]> Date: Mon Nov 18 10:24:27 2024 +0000 CCM-7249: update template title/description commit ae53f53 Author: Michael Harrison <[email protected]> Date: Fri Nov 15 11:45:02 2024 +0000 CCM-7249: remove debug logs commit 75c4713 Merge: cb6580c 9e776f2 Author: Michael Harrison <[email protected]> Date: Thu Nov 14 18:00:55 2024 +0000 Merge branch 'main' into feature/api-spec-testing commit cb6580c Author: Michael Harrison <[email protected]> Date: Thu Nov 14 17:57:44 2024 +0000 CCM-7249: typescript config for lambdas commit 676d173 Author: Michael Harrison <[email protected]> Date: Mon Nov 11 17:44:47 2024 +0000 CCM-7249: typo commit 44cb91a Author: Michael Harrison <[email protected]> Date: Mon Nov 11 17:28:01 2024 +0000 CCM-7249: add tests, connect authorizer commit 5f73e2c Author: Michael Harrison <[email protected]> Date: Mon Nov 11 13:22:05 2024 +0000 CCM-7249: grr commit de16a08 Author: Michael Harrison <[email protected]> Date: Mon Nov 11 13:18:27 2024 +0000 CCM-7249: fix apig lambda integration commit a2f86a7 Author: Michael Harrison <[email protected]> Date: Mon Nov 11 12:51:17 2024 +0000 CCM-7249: missed one commit e83916f Author: Michael Harrison <[email protected]> Date: Mon Nov 11 12:40:27 2024 +0000 CCM-7249: fix templatefile syntax commit 448a41d Author: Michael Harrison <[email protected]> Date: Mon Nov 11 10:17:18 2024 +0000 CCM-7249: always run ts build commit b6507d2 Author: Michael Harrison <[email protected]> Date: Fri Nov 8 18:21:11 2024 +0000 CCM-7249: fix path commit 88a43c4 Author: Michael Harrison <[email protected]> Date: Fri Nov 8 18:16:34 2024 +0000 CCM-7249: split lambdas commit 226c81c Author: Michael Harrison <[email protected]> Date: Fri Nov 8 15:36:42 2024 +0000 CCM-7249: fix spec ref commit 371fd76 Author: Michael Harrison <[email protected]> Date: Fri Nov 8 15:32:27 2024 +0000 CCM-7249: fix ref commit 9fbdd4e Author: Michael Harrison <[email protected]> Date: Fri Nov 8 15:20:02 2024 +0000 CCM-7249: move lambdas to lambdas dir commit 5075d96 Author: Michael Harrison <[email protected]> Date: Fri Nov 8 14:52:40 2024 +0000 CCM-7249: testing commit 3bcfbb7 Author: Michael Harrison <[email protected]> Date: Fri Nov 8 14:35:47 2024 +0000 CCM-7249: fix path commit 9e3f8a3 Author: Michael Harrison <[email protected]> Date: Fri Nov 8 12:07:04 2024 +0000 CCM-7249: fix ref commit 27358a5 Author: Michael Harrison <[email protected]> Date: Fri Nov 8 10:36:37 2024 +0000 CCM-7249: pass through lambda props commit 9cd9bb8 Author: Michael Harrison <[email protected]> Date: Fri Nov 8 10:28:23 2024 +0000 CCM-7249: commit the right things commit 2cc769e Author: Michael Harrison <[email protected]> Date: Fri Nov 8 10:23:28 2024 +0000 CCM-7249: rejig things commit 8a2678c Author: Michael Harrison <[email protected]> Date: Thu Nov 7 15:25:36 2024 +0000 CCM-7249: update terraform commit 970fc13 Author: Michael Harrison <[email protected]> Date: Thu Nov 7 11:02:35 2024 +0000 CCM-7249: build fix commit b1079ed Author: Michael Harrison <[email protected]> Date: Thu Nov 7 10:55:45 2024 +0000 CCM-7249: dependencies commit 5386839 Author: Michael Harrison <[email protected]> Date: Thu Nov 7 10:31:08 2024 +0000 CCM-7249: try fix pre.sh commit 9e40870 Author: Michael Harrison <[email protected]> Date: Wed Nov 6 17:42:05 2024 +0000 CCM-7249: exit 0 again commit 3dd30f7 Author: Michael Harrison <[email protected]> Date: Wed Nov 6 15:10:13 2024 +0000 CCM-7249: copy final echo from other repo commit a027f83 Author: Michael Harrison <[email protected]> Date: Wed Nov 6 12:46:24 2024 +0000 CCM-7249: remove exit 0 commit 0936268 Author: Michael Harrison <[email protected]> Date: Wed Nov 6 11:33:06 2024 +0000 CCM-7249: set -x in pre.sh commit dabc065 Author: Michael Harrison <[email protected]> Date: Wed Nov 6 11:29:03 2024 +0000 CCM-7249: exit 0 commit 84d8163 Author: Chris Elliott <[email protected]> Date: Tue Nov 5 15:45:33 2024 +0000 Add debug logging commit c936a39 Author: Chris Elliott <[email protected]> Date: Tue Nov 5 15:39:42 2024 +0000 Update pre.sh commit b9ba372 Author: Chris Elliott <[email protected]> Date: Tue Nov 5 15:29:21 2024 +0000 Add types/node to dependencies commit e171bd0 Author: Chris Elliott <[email protected]> Date: Tue Nov 5 15:25:29 2024 +0000 Add new tsconfig commit c3a9ff7 Author: Chris Elliott <[email protected]> Date: Tue Nov 5 15:17:19 2024 +0000 Add to tsconfig lib commit ecb7df8 Author: Chris Elliott <[email protected]> Date: Tue Nov 5 15:09:11 2024 +0000 Add to tsconfig lib commit 5a08294 Author: Chris Elliott <[email protected]> Date: Tue Nov 5 15:01:48 2024 +0000 Add initial terraform
1 parent 7a7be81 commit c0e3291

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+9454
-14
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
# dependencies
1818
node_modules
19+
.node-version
1920
*/node_modules
2021
/.pnp
2122
.pnp.js
@@ -47,6 +48,7 @@ npm-debug.log*
4748
# typescript
4849
*.tsbuildinfo
4950
next-env.d.ts
51+
.swc
5052

5153
# reports
5254
reports

infrastructure/terraform/components/app/amplify_app.tf

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ resource "aws_amplify_app" "main" {
2727
]
2828

2929
environment_variables = {
30-
NOTIFY_GROUP = var.group
31-
NOTIFY_ENVIRONMENT = var.environment
32-
NOTIFY_DOMAIN_NAME = local.root_domain_name
33-
ACCOUNT_ID = var.aws_account_id
34-
NEXT_PUBLIC_DISABLE_CONTENT = var.disable_content
30+
NOTIFY_GROUP = var.group
31+
NOTIFY_ENVIRONMENT = var.environment
32+
NOTIFY_DOMAIN_NAME = local.root_domain_name
33+
ACCOUNT_ID = var.aws_account_id
34+
NEXT_PUBLIC_DISABLE_CONTENT = var.disable_content
3535
}
3636
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
module "templates_api" {
2+
source = "../../modules/templates-api"
3+
4+
project = var.project
5+
environment = var.environment
6+
aws_account_id = var.aws_account_id
7+
region = var.region
8+
group = var.group
9+
csi = local.csi
10+
log_retention_in_days = var.log_retention_in_days
11+
}

infrastructure/terraform/components/app/outputs.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,7 @@ output "amplify" {
44
domain_name = local.root_domain_name
55
}
66
}
7+
8+
output "api_invoke_url" {
9+
value = module.templates_api.api_invoke_url
10+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
resource "aws_cloudwatch_log_group" "lambda" {
2+
name = "/aws/lambda/${var.function_name}"
3+
retention_in_days = var.log_retention_in_days
4+
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
resource "aws_iam_role" "lambda_execution_role" {
2+
name = "${var.function_name}-execution-role"
3+
description = "IAM Role for Lambda function ${var.function_name}"
4+
assume_role_policy = data.aws_iam_policy_document.lambda_service_trust_policy.json
5+
}
6+
7+
resource "aws_iam_role_policy" "lambda_execution_policy" {
8+
role = aws_iam_role.lambda_execution_role.name
9+
name = "${var.function_name}-execution-policy"
10+
policy = data.aws_iam_policy_document.lambda_execution_policy.json
11+
}
12+
13+
data "aws_iam_policy_document" "lambda_service_trust_policy" {
14+
statement {
15+
sid = "LambdaAssumeRole"
16+
effect = "Allow"
17+
18+
actions = [
19+
"sts:AssumeRole",
20+
]
21+
22+
principals {
23+
type = "Service"
24+
25+
identifiers = [
26+
"lambda.amazonaws.com"
27+
]
28+
}
29+
}
30+
}
31+
32+
data "aws_iam_policy_document" "lambda_execution_policy" {
33+
source_policy_documents = [
34+
var.execution_role_policy_document
35+
]
36+
37+
statement {
38+
sid = "AllowLogs"
39+
effect = "Allow"
40+
41+
actions = [
42+
"logs:CreateLogStream",
43+
"logs:PutLogEvents"
44+
]
45+
46+
resources = [
47+
"${aws_cloudwatch_log_group.lambda.arn}:log-stream:*",
48+
]
49+
}
50+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
resource "aws_lambda_function" "main" {
2+
description = var.description
3+
function_name = var.function_name
4+
role = aws_iam_role.lambda_execution_role.arn
5+
filename = var.filename
6+
source_code_hash = var.source_code_hash
7+
handler = var.handler
8+
runtime = var.runtime
9+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
output "function_arn" {
2+
value = aws_lambda_function.main.arn
3+
}
4+
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
variable "description" {
2+
type = string
3+
description = "Description of what your Lambda Function does"
4+
}
5+
6+
variable "execution_role_policy_document" {
7+
type = string
8+
description = "IAM Policy Document containing additional runtime permissions for the Lambda function beyond the basic execution policy"
9+
default = ""
10+
}
11+
12+
variable "filename" {
13+
type = string
14+
description = "Path to the function's deployment package within the local filesystem"
15+
}
16+
17+
variable "function_name" {
18+
type = string
19+
description = "Unique name of the Lambda function"
20+
}
21+
22+
variable "source_code_hash" {
23+
type = string
24+
description = "Base64-encoded SHA256 hash of the package file specified by `filename`"
25+
}
26+
27+
variable "handler" {
28+
type = string
29+
description = "Function entrypoint in your code"
30+
}
31+
32+
variable "runtime" {
33+
type = string
34+
description = "Identifier of the function's runtime"
35+
default = "nodejs20.x"
36+
}
37+
38+
variable "log_retention_in_days" {
39+
type = number
40+
description = "Specifies the number of days you want to retain log events in the log group for this Lambda"
41+
default = 0
42+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
resource "aws_api_gateway_deployment" "main" {
2+
rest_api_id = aws_api_gateway_rest_api.main.id
3+
description = "Templates API deployment"
4+
5+
triggers = {
6+
openapi_hash = sha1(jsonencode(local.openapi_spec)),
7+
}
8+
9+
variables = {
10+
deployed_at = timestamp()
11+
}
12+
13+
lifecycle {
14+
create_before_destroy = true
15+
}
16+
}

0 commit comments

Comments
 (0)