Skip to content

Commit d5d534f

Browse files
committed
NDR-164 Mock response
1 parent d0af279 commit d5d534f

File tree

2 files changed

+53
-4
lines changed

2 files changed

+53
-4
lines changed

infrastructure/api-mtls.tf

Lines changed: 52 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,60 @@ resource "aws_api_gateway_base_path_mapping" "mtls_api_mapping" {
3333
depends_on = [aws_api_gateway_deployment.mtls_api_deploy]
3434
}
3535

36-
# Dummy Lambda integration for POC
37-
resource "aws_api_gateway_resource" "mtls_test_lambda" {
36+
# Mock integration for testing POC
37+
resource "aws_api_gateway_resource" "mtls_test_mock" {
3838
rest_api_id = aws_api_gateway_rest_api.mtls_doc_store_api.id
3939
parent_id = aws_api_gateway_rest_api.mtls_doc_store_api.root_resource_id
40-
path_part = "test_lambda"
40+
path_part = "test_mock"
41+
}
42+
43+
resource "aws_api_gateway_method" "mtls_test_mock_method" {
44+
rest_api_id = aws_api_gateway_rest_api.mtls_doc_store_api.id
45+
resource_id = aws_api_gateway_resource.mtls_test_mock.id
46+
http_method = "GET"
47+
authorization = "NONE"
48+
}
49+
50+
resource "aws_api_gateway_integration" "mtls_test_mock_integration" {
51+
rest_api_id = aws_api_gateway_rest_api.mtls_doc_store_api.id
52+
resource_id = aws_api_gateway_resource.mtls_test_mock.id
53+
http_method = aws_api_gateway_method.mtls_test_mock_method.http_method
54+
type = "MOCK"
55+
integration_http_method = "GET"
56+
57+
request_templates = {
58+
"application/json" = <<EOF
59+
{
60+
"statusCode": 200
61+
}
62+
EOF
63+
}
64+
}
65+
66+
resource "aws_api_gateway_method_response" "mtls_test_mock_response" {
67+
rest_api_id = aws_api_gateway_rest_api.mtls_doc_store_api.id
68+
resource_id = aws_api_gateway_resource.mtls_test_mock.id
69+
http_method = aws_api_gateway_method.mtls_test_mock_method.http_method
70+
status_code = "200"
71+
72+
response_models = {
73+
"application/json" = "Empty"
74+
}
75+
}
76+
77+
resource "aws_api_gateway_integration_response" "mtls_test_mock_integration_response" {
78+
rest_api_id = aws_api_gateway_rest_api.mtls_doc_store_api.id
79+
resource_id = aws_api_gateway_resource.mtls_test_mock.id
80+
http_method = aws_api_gateway_method.mtls_test_mock_method.http_method
81+
status_code = aws_api_gateway_method_response.mtls_test_mock_response.status_code
82+
83+
response_templates = {
84+
"application/json" = <<EOF
85+
{
86+
"message": "Hello from mTLS MOCK endpoint!"
87+
}
88+
EOF
89+
}
4190
}
4291

4392
resource "aws_api_gateway_deployment" "mtls_api_deploy" {

infrastructure/modules/route53/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ resource "aws_route53_record" "ndr_mtls_gateway_api_record" {
3737
count = var.create_mtls_gateway_api_record ? 1 : 0
3838
name = var.api_gateway_subdomain_name
3939
type = "A"
40-
zone_id = local.zone_id
40+
zone_id = var.api_gateway_zone_id
4141

4242
alias {
4343
name = var.api_gateway_subdomain_name

0 commit comments

Comments
 (0)