Skip to content

Commit f4a1aee

Browse files
committed
VED-26: Resolve Sonar warning. Add pre-deploy check for private subnets.
1 parent 052183b commit f4a1aee

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

backend/src/models/utils/permission_checker.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def _expand_permissions(permissions: list[str]) -> dict[str, list[ApiOperationCo
2323
def validate_permissions(permissions: list[str], operation: ApiOperationCode, vaccine_types: list[str]):
2424
expanded_permissions = _expand_permissions(permissions)
2525
print(f"operation: {operation}, expanded_permissions: {expanded_permissions}, vaccine_types: {vaccine_types}")
26-
return all([
26+
return all(
2727
operation in expanded_permissions.get(vaccine_type.lower(), [])
2828
for vaccine_type in vaccine_types
29-
])
29+
)

terraform/variables.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,13 @@ locals {
3838
private_subnet_ids = [for k, v in data.aws_route.internet_traffic_route_by_subnet : k if length(v.nat_gateway_id) > 0]
3939
}
4040

41+
check "private_subnets" {
42+
assert {
43+
condition = length(local.private_subnet_ids) > 0
44+
error_message = "No private subnets with internet access found in VPC ${data.aws_vpc.default.id}"
45+
}
46+
}
47+
4148
data "aws_vpc" "default" {
4249
default = true
4350
}

0 commit comments

Comments
 (0)