Skip to content

Commit 3dca95b

Browse files
committed
CCM-11496: lock templates when submitting routing config
1 parent 585f3a8 commit 3dca95b

File tree

18 files changed

+831
-132
lines changed

18 files changed

+831
-132
lines changed

infrastructure/terraform/modules/backend-api/module_submit_routing_config_lambda.tf

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,20 @@ module "submit_routing_config_lambda" {
3737

3838
data "aws_iam_policy_document" "submit_routing_config_lambda_policy" {
3939
statement {
40-
sid = "AllowDynamoAccess"
40+
sid = "AllowDynamoRoutingConfigRead"
41+
effect = "Allow"
42+
43+
actions = [
44+
"dynamodb:GetItem",
45+
]
46+
47+
resources = [
48+
aws_dynamodb_table.routing_configuration.arn,
49+
]
50+
}
51+
52+
statement {
53+
sid = "AllowDynamoTemplatesRoutingConfigWrite"
4154
effect = "Allow"
4255

4356
actions = [
@@ -46,6 +59,7 @@ data "aws_iam_policy_document" "submit_routing_config_lambda_policy" {
4659

4760
resources = [
4861
aws_dynamodb_table.routing_configuration.arn,
62+
aws_dynamodb_table.templates.arn,
4963
]
5064
}
5165

infrastructure/terraform/modules/backend-api/module_update_routing_config_lambda.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ module "update_routing_config_lambda" {
1313

1414
function_module_name = "update-routing-config"
1515
handler_function_name = "handler"
16-
description = "Submit Routing Config API endpoint"
16+
description = "Update Routing Config API endpoint"
1717

1818
memory = 2048
1919
timeout = 3

infrastructure/terraform/modules/backend-api/spec.tmpl.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -769,6 +769,7 @@
769769
"TemplateStatus": {
770770
"enum": [
771771
"DELETED",
772+
"LOCKED",
772773
"NOT_YET_SUBMITTED",
773774
"PENDING_PROOF_REQUEST",
774775
"PENDING_UPLOAD",

lambdas/backend-api/src/__tests__/infra/routing-config-repository/query.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ function setup() {
2424
// pass an actual doc client - it gets intercepted up by mockClient,
2525
// but paginateQuery needs the real deal
2626
DynamoDBDocumentClient.from(new DynamoDBClient({})),
27-
TABLE_NAME
27+
{ routingConfigTableName: TABLE_NAME, templatesTableName: '' }
2828
);
2929

3030
const mocks = { dynamo };

0 commit comments

Comments
 (0)