Skip to content

Commit fcb0b02

Browse files
committed
Refactor API Gateway resource for document versioning and update request parameters
Signed-off-by: NogaNHS <[email protected]>
1 parent f0d561f commit fcb0b02

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

infrastructure/gateway-review-document.tf

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,25 @@ module "review_document_gateway" {
1010
origin = contains(["prod"], terraform.workspace) ? "'https://${var.domain}'" : "'https://${terraform.workspace}.${var.domain}'"
1111
}
1212

13-
module "review_document_id_gateway" {
13+
resource "aws_api_gateway_resource" "review_document_id" {
14+
rest_api_id = aws_api_gateway_rest_api.ndr_doc_store_api.id
15+
parent_id = module.review_document_gateway.gateway_resource_id
16+
path_part = "{id}"
17+
}
18+
19+
module "review_document_version_gateway" {
1420
source = "./modules/gateway"
1521
api_gateway_id = aws_api_gateway_rest_api.ndr_doc_store_api.id
16-
parent_id = module.review_document_gateway.gateway_resource_id
22+
parent_id = aws_api_gateway_resource.review_document_id.id
1723
http_methods = ["GET", "PATCH"]
1824
authorization = "CUSTOM"
19-
gateway_path = "{id}/{version}"
25+
gateway_path = "{version}"
2026
authorizer_id = aws_api_gateway_authorizer.repo_authoriser.id
2127
require_credentials = true
2228
origin = contains(["prod"], terraform.workspace) ? "'https://${var.domain}'" : "'https://${terraform.workspace}.${var.domain}'"
2329

2430
request_parameters = {
25-
"method.request.path.id" = true
31+
"method.request.path.id" = true
32+
"method.request.path.version" = true
2633
}
2734
}

0 commit comments

Comments
 (0)