@@ -2,50 +2,12 @@ resource "aws_api_gateway_rest_api" "api_gateway_rest_api" {
22 name = " ${ var . prefix } --${ var . apitype } "
33 description = " Manages an API Gateway Rest API."
44 disable_execute_api_endpoint = true
5- body = templatefile (" ${ path . module } /../../../../api/${ var . apitype } /swagger.yaml" , var. lambdas )
6- }
7-
8- resource "aws_api_gateway_resource" "capability" {
9- rest_api_id = aws_api_gateway_rest_api. api_gateway_rest_api . id
10- parent_id = aws_api_gateway_rest_api. api_gateway_rest_api . root_resource_id
11- path_part = " metadata"
12- }
13-
14- resource "aws_api_gateway_method" "capability" {
15- rest_api_id = aws_api_gateway_rest_api. api_gateway_rest_api . id
16- resource_id = aws_api_gateway_resource. capability . id
17- http_method = " GET"
18- authorization = " NONE"
19-
20- depends_on = [aws_api_gateway_resource . capability ]
21- }
22-
23- resource "aws_api_gateway_integration" "capability" {
24- rest_api_id = aws_api_gateway_rest_api. api_gateway_rest_api . id
25- resource_id = aws_api_gateway_resource. capability . id
26- http_method = aws_api_gateway_method. capability . http_method
27- type = " MOCK"
28- request_templates = {
29- " application/json" = jsonencode({ "statusCode" = 200 })
30- }
31- }
32-
33- resource "aws_api_gateway_method_response" "capability_200" {
34- rest_api_id = aws_api_gateway_rest_api. api_gateway_rest_api . id
35- resource_id = aws_api_gateway_resource. capability . id
36- http_method = aws_api_gateway_method. capability . http_method
37- status_code = " 200"
38- }
39-
40- resource "aws_api_gateway_integration_response" "capability" {
41- rest_api_id = aws_api_gateway_rest_api. api_gateway_rest_api . id
42- resource_id = aws_api_gateway_resource. capability . id
43- http_method = aws_api_gateway_method. capability . http_method
44- status_code = aws_api_gateway_method_response. capability_200 . status_code
45-
46- response_templates = {
47- " application/json" = var.capability_statement_content
48- }
5+ body = templatefile (
6+ " ${ path . module } /../../../../api/${ var . apitype } /swagger.yaml" ,
7+ merge (var. lambdas , {
8+ capability_statement_json = var.capability_statement_content
9+ })
10+ )
4911}
5012
5113resource "aws_api_gateway_deployment" "api_gateway_deployment" {
@@ -65,11 +27,6 @@ resource "aws_api_gateway_deployment" "api_gateway_deployment" {
6527
6628 depends_on = [
6729 aws_api_gateway_rest_api . api_gateway_rest_api ,
68- aws_api_gateway_resource . capability ,
69- aws_api_gateway_method . capability ,
70- aws_api_gateway_integration . capability ,
71- aws_api_gateway_method_response . capability_200 ,
72- aws_api_gateway_integration_response . capability ,
7330 aws_api_gateway_integration_response . head_integration_response
7431 ]
7532}
0 commit comments