Skip to content

Commit 2b6e864

Browse files
Merge remote-tracking branch 'origin/test/test-api' into test/test-api
2 parents 8fc6b55 + e5a5587 commit 2b6e864

125 files changed

Lines changed: 7536 additions & 4084 deletions

File tree

Some content is hidden

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

.github/workflows/cicd-2-publish.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ jobs:
141141
# asset_name: lambda-${{ needs.metadata.outputs.version }}.zip
142142
# asset_content_type: application/zip
143143
- name: "Notify Slack on PR merge"
144-
uses: slackapi/slack-github-action@v2.1.0
144+
uses: slackapi/slack-github-action@v2.1.1
145145
with:
146146
webhook: ${{ secrets.SLACK_WEBHOOK_URL }}
147147
webhook-type: webhook-trigger

.tool-versions

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
terraform 1.12.1
44
pre-commit 4.2.0
55
vale 3.11.2
6-
poetry 2.1.3
6+
poetry 2.1.4
77
act 0.2.77
8+
nodejs 22.18.0
89

910
# ==============================================================================
1011
# The section below is reserved for Docker image versions.

README.md

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -189,15 +189,25 @@ graph TB
189189
direction TB
190190
App["app.py (WireUp DI)"]
191191
Config["config.py, error_handler.py"]
192+
subgraph "Audit Layer"
193+
direction TB
194+
Audit["audit/audit_service.py"]
195+
AuditModels["audit/audit_models.py"]
196+
end
197+
subgraph "Validation Layer"
198+
direction TB
199+
Validator["common/request_validator.py"]
200+
ApiErrResp["common/api_error_response.py"]
201+
end
192202
subgraph "Presentation Layer"
193203
direction TB
194204
View["views/eligibility.py"]
195-
ResponseModel["views/response_model/eligibility.py"]
205+
ResponseModel["views/response_model/eligibility_response.py"]
196206
end
197207
subgraph "Business Logic Layer"
198208
direction TB
199209
Service["services/eligibility_services.py"]
200-
Operators["services/rules/operators.py"]
210+
Operators["services/operators/operators.py"]
201211
end
202212
subgraph "Data Access Layer"
203213
direction TB
@@ -207,24 +217,30 @@ graph TB
207217
end
208218
subgraph "Models"
209219
direction TB
210-
ModelElig["model/eligibility.py"]
211-
ModelRules["model/rules.py"]
220+
ModelElig["model/eligibility_status.py"]
221+
ModelRules["model/campaign_config.py"]
212222
end
213223
end
214224
215225
Lambda -->|"loads"| App
216226
App -->|injects| View
217227
View -->|calls| Service
228+
View -->|validates via| Validator
229+
View -->|audits via| Audit
230+
View -->|uses| RespModel
231+
Audit -->|uses| AuditModels
232+
Validator -->|uses| ApiErrResp
233+
218234
Service -->|calls| Operators
219235
Service -->|calls| PersonRepo
220236
Service -->|calls| CampaignRepo
221237
PersonRepo -->|uses| DynamoDB
222238
CampaignRepo -->|uses| S3Bucket
223-
View -->|uses| ResponseModel
224239
App -->|reads| Config
240+
App -->|wires| Factory
241+
225242
Service -->|uses| ModelElig
226243
Operators -->|uses| ModelRules
227-
App -->|wires| Factory
228244
229245
```
230246

infrastructure/modules/dynamodb/dynamodb.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ resource "aws_dynamodb_table" "dynamodb_table" {
22
name = "${terraform.workspace == "default" ? "" : "${terraform.workspace}-"}${var.project_name}-${var.environment}-${var.table_name_suffix}"
33
billing_mode = "PAY_PER_REQUEST"
44
hash_key = var.partition_key
5+
deletion_protection_enabled = var.environment == "prod"
56

67
attribute {
78
name = var.partition_key

infrastructure/modules/lambda/lambda.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ resource "aws_lambda_function" "eligibility_signposting_lambda" {
2222
KINESIS_AUDIT_STREAM_TO_S3 = var.kinesis_audit_stream_to_s3_name
2323
ENV = var.environment
2424
LOG_LEVEL = var.log_level
25+
ENABLE_XRAY_PATCHING = var.enable_xray_patching
2526
}
2627
}
2728

infrastructure/modules/lambda/variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,8 @@ variable "log_level" {
4747
description = "log level"
4848
type = string
4949
}
50+
51+
variable "enable_xray_patching"{
52+
description = "flag to enable xray tracing, which puts an entry for dynamodb, s3 and firehose in trace map"
53+
type = string
54+
}

infrastructure/modules/s3/s3.tf

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,14 +105,57 @@ data "aws_iam_policy_document" "access_logs_s3_bucket_policy" {
105105
variable = "aws:SecureTransport"
106106
}
107107
}
108+
109+
# Allow S3 Log Delivery service to write access logs
110+
statement {
111+
sid = "S3ServerAccessLogsPolicy"
112+
effect = "Allow"
113+
principals {
114+
type = "Service"
115+
identifiers = ["logging.s3.amazonaws.com"]
116+
}
117+
actions = [
118+
"s3:PutObject"
119+
]
120+
resources = [
121+
"${aws_s3_bucket.storage_bucket_access_logs.arn}/*"
122+
]
123+
condition {
124+
test = "ArnEquals"
125+
variable = "aws:SourceArn"
126+
values = [aws_s3_bucket.storage_bucket.arn]
127+
}
128+
}
129+
130+
# Allow S3 Log Delivery service to check bucket location and get bucket ACL
131+
statement {
132+
sid = "S3ServerAccessLogsDeliveryRootAccess"
133+
effect = "Allow"
134+
principals {
135+
type = "Service"
136+
identifiers = ["logging.s3.amazonaws.com"]
137+
}
138+
actions = [
139+
"s3:GetBucketAcl",
140+
"s3:ListBucket"
141+
]
142+
resources = [
143+
aws_s3_bucket.storage_bucket_access_logs.arn
144+
]
145+
condition {
146+
test = "ArnEquals"
147+
variable = "aws:SourceArn"
148+
values = [aws_s3_bucket.storage_bucket.arn]
149+
}
150+
}
108151
}
109152

110153
resource "aws_s3_bucket_server_side_encryption_configuration" "storage_bucket_access_logs_server_side_encryption_config" {
111154
bucket = aws_s3_bucket.storage_bucket_access_logs.id
112155

113156
rule {
114157
apply_server_side_encryption_by_default {
115-
sse_algorithm = "aws:kms"
158+
sse_algorithm = "aws:kms"
116159
kms_master_key_id = aws_kms_key.storage_bucket_cmk.arn
117160
}
118161
}

infrastructure/stacks/api-layer/assumed_role_permissions_boundary.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ data "aws_iam_policy_document" "assumed_role_permissions_boundary" {
3333
"support:*",
3434
"sqs:*",
3535
"tag:*",
36-
"trustedadvisor:*"
36+
"trustedadvisor:*",
37+
"xray:*"
3738
]
3839

3940
resources = ["*"]

0 commit comments

Comments
 (0)