File tree Expand file tree Collapse file tree 4 files changed +32
-15
lines changed
Expand file tree Collapse file tree 4 files changed +32
-15
lines changed Original file line number Diff line number Diff line change @@ -21,3 +21,19 @@ module "document_reference_gateway" {
2121 require_credentials = true
2222 origin = contains ([" prod" ], terraform. workspace ) ? " 'https://${ var . domain } '" : " 'https://${ terraform . workspace } .${ var . domain } '"
2323}
24+
25+ module "document_reference_id_gateway" {
26+ source = " ./modules/gateway"
27+ api_gateway_id = aws_api_gateway_rest_api. ndr_doc_store_api . id
28+ parent_id = module. document_reference_gateway . gateway_resource_id
29+ http_methods = [" PUT" ]
30+ authorization = " CUSTOM"
31+ gateway_path = " {id}"
32+ authorizer_id = aws_api_gateway_authorizer. repo_authoriser . id
33+ require_credentials = true
34+ origin = contains ([" prod" ], terraform. workspace ) ? " 'https://${ var . domain } '" : " 'https://${ terraform . workspace } .${ var . domain } '"
35+
36+ request_parameters = {
37+ " method.request.path.id" = true
38+ }
39+ }
Original file line number Diff line number Diff line change 1- resource "aws_api_gateway_resource" "update_document_reference_with_id" {
2- rest_api_id = aws_api_gateway_rest_api. ndr_doc_store_api . id
3- parent_id = module. document_reference_gateway . gateway_resource_id
4- path_part = " {id}"
5- }
6-
71resource "aws_api_gateway_method" "update_document_reference_with_id" {
82 rest_api_id = aws_api_gateway_rest_api. ndr_doc_store_api . id
9- resource_id = aws_api_gateway_resource . update_document_reference_with_id . id
3+ resource_id = module . document_reference_id_gateway . gateway_resource_id . id
104 http_method = " PUT"
115 authorization = " CUSTOM"
126 authorizer_id = aws_api_gateway_authorizer. repo_authoriser . id
@@ -73,7 +67,7 @@ module "update_doc_ref_lambda" {
7367 ]
7468 kms_deletion_window = var. kms_deletion_window
7569 rest_api_id = aws_api_gateway_rest_api. ndr_doc_store_api . id
76- resource_id = aws_api_gateway_resource . update_document_reference_with_id . id
70+ resource_id = module . document_reference_id_gateway . gateway_resource_id . id
7771 http_methods = [" PUT" ]
7872 memory_size = 512
7973
Original file line number Diff line number Diff line change @@ -13,13 +13,14 @@ resource "aws_api_gateway_method" "preflight_method" {
1313}
1414
1515resource "aws_api_gateway_method" "proxy_method" {
16- for_each = toset (var. http_methods )
17- rest_api_id = var. api_gateway_id
18- resource_id = aws_api_gateway_resource. gateway_resource . id
19- http_method = each. key
20- authorization = var. authorization
21- authorizer_id = var. authorizer_id
22- api_key_required = var. api_key_required
16+ for_each = toset (var. http_methods )
17+ rest_api_id = var. api_gateway_id
18+ resource_id = aws_api_gateway_resource. gateway_resource . id
19+ http_method = each. key
20+ authorization = var. authorization
21+ authorizer_id = var. authorizer_id
22+ api_key_required = var. api_key_required
23+ request_parameters = var. request_parameters
2324}
2425
2526resource "aws_api_gateway_method_response" "preflight_method_response" {
Original file line number Diff line number Diff line change @@ -45,3 +45,9 @@ variable "api_key_required" {
4545 type = bool
4646 default = false
4747}
48+
49+ variable "request_parameters" {
50+ description = " Request parameters for the API Gateway method."
51+ type = map (string )
52+ default = {}
53+ }
You can’t perform that action at this time.
0 commit comments