@@ -10,17 +10,14 @@ resource "aws_api_gateway_rest_api" "api" {
1010}
1111
1212resource "aws_api_gateway_deployment" "stage" {
13- depends_on = [
14- aws_api_gateway_integration . root_method_integration ,
15- aws_api_gateway_integration . integration
16- ]
17- rest_api_id = " ${ aws_api_gateway_rest_api . api . id } "
13+ rest_api_id = aws_api_gateway_rest_api. api . id
1814 stage_name = var. env
15+ stage_description = md5 (file (var. swagger-path ))
1916}
2017
2118# Create only if root-resource is not empty
2219resource "aws_api_gateway_method" "root_method" {
23- count = " ${ var . root-resource == true ? 1 : 0 } "
20+ count = var. root-resource == true ? 1 : 0
2421
2522 rest_api_id = aws_api_gateway_rest_api. api . id
2623 resource_id = aws_api_gateway_rest_api. api . root_resource_id
@@ -31,7 +28,7 @@ resource "aws_api_gateway_method" "root_method" {
3128}
3229
3330resource "aws_api_gateway_integration" "root_method_integration" {
34- count = " ${ var . root-resource == true ? 1 : 0 } "
31+ count = var. root-resource == true ? 1 : 0
3532
3633 rest_api_id = aws_api_gateway_rest_api. api . id
3734 resource_id = aws_api_gateway_rest_api. api . root_resource_id
@@ -42,26 +39,26 @@ resource "aws_api_gateway_integration" "root_method_integration" {
4239}
4340
4441resource "aws_api_gateway_resource" "resource" {
45- count = " ${ length (var. method-paths )} "
46- path_part = " ${ var . method-paths [count . index ]} "
42+ count = length (var. method-paths )
43+ path_part = var. method-paths [count . index ]
4744 parent_id = aws_api_gateway_rest_api. api . root_resource_id
4845 rest_api_id = aws_api_gateway_rest_api. api . id
4946}
5047
5148resource "aws_api_gateway_method" "method" {
52- count = " ${ length (var. method-paths )} "
49+ count = length (var. method-paths )
5350 rest_api_id = aws_api_gateway_rest_api. api . id
54- resource_id = " ${ aws_api_gateway_resource . resource [count . index ]. id } "
55- http_method = " ${ var . method-types [count . index ]} "
51+ resource_id = aws_api_gateway_resource. resource [count . index ]. id
52+ http_method = var. method-types [count . index ]
5653 authorization = var. resource-authorization
5754 request_parameters = var. resource-request-params
5855}
5956
6057resource "aws_api_gateway_integration" "integration" {
61- count = " ${ length (var. method-paths )} "
58+ count = length (var. method-paths )
6259 rest_api_id = aws_api_gateway_rest_api. api . id
63- resource_id = " ${ aws_api_gateway_resource . resource [count . index ]. id } "
64- http_method = " ${ aws_api_gateway_method . method [count . index ]. http_method } "
60+ resource_id = aws_api_gateway_resource. resource [count . index ]. id
61+ http_method = aws_api_gateway_method. method [count . index ]. http_method
6562 integration_http_method = " POST"
6663 type = " AWS_PROXY"
6764 uri = aws_lambda_function. lambda . invoke_arn
@@ -177,7 +174,7 @@ resource aws_lambda_function "lambda" {
177174 timeout = var. timeout
178175 vpc_config {
179176 security_group_ids = [
180- " ${ aws_security_group . vpc_sec . id } " ]
177+ aws_security_group . vpc_sec . id ]
181178 subnet_ids = module. acs . private_subnet_ids
182179 }
183180 environment {
0 commit comments