@@ -9,7 +9,7 @@ terraform {
99
1010 archive = {
1111 source = " hashicorp/archive"
12- version = " ~> 1.2 "
12+ version = " ~> 2.0 "
1313 }
1414 }
1515}
@@ -71,78 +71,73 @@ locals {
7171
7272# HTTP API
7373
74- resource aws_apigatewayv2_integration proxy {
74+ resource " aws_apigatewayv2_integration" " proxy" {
7575 api_id = local. http_api . id
7676 connection_type = " INTERNET"
7777 description = local. http_api . integration_description
7878 integration_method = " POST"
7979 integration_type = " AWS_PROXY"
8080 integration_uri = aws_lambda_function. api . invoke_arn
81- passthrough_behavior = " WHEN_NO_MATCH"
8281 timeout_milliseconds = 3000
83-
84- lifecycle {
85- ignore_changes = [passthrough_behavior ]
86- }
8782}
8883
89- resource aws_apigatewayv2_route post_callbacks {
84+ resource " aws_apigatewayv2_route" " post_callbacks" {
9085 api_id = local. http_api . id
9186 route_key = " POST ${ local . http_api . route_prefix } callbacks"
9287 authorization_type = " NONE"
9388 target = " integrations/${ aws_apigatewayv2_integration . proxy . id } "
9489}
9590
96- resource aws_apigatewayv2_route post_events {
91+ resource " aws_apigatewayv2_route" " post_events" {
9792 api_id = local. http_api . id
9893 route_key = " POST ${ local . http_api . route_prefix } events"
9994 authorization_type = " NONE"
10095 target = " integrations/${ aws_apigatewayv2_integration . proxy . id } "
10196}
10297
103- resource aws_apigatewayv2_route get_health {
98+ resource " aws_apigatewayv2_route" " get_health" {
10499 api_id = local. http_api . id
105100 route_key = " GET ${ local . http_api . route_prefix } health"
106101 authorization_type = " NONE"
107102 target = " integrations/${ aws_apigatewayv2_integration . proxy . id } "
108103}
109104
110- resource aws_apigatewayv2_route get_install {
105+ resource " aws_apigatewayv2_route" " get_install" {
111106 api_id = local. http_api . id
112107 route_key = " GET ${ local . http_api . route_prefix } install"
113108 authorization_type = " NONE"
114109 target = " integrations/${ aws_apigatewayv2_integration . proxy . id } "
115110}
116111
117- resource aws_apigatewayv2_route head_install {
112+ resource " aws_apigatewayv2_route" " head_install" {
118113 api_id = local. http_api . id
119114 route_key = " HEAD ${ local . http_api . route_prefix } install"
120115 authorization_type = " NONE"
121116 target = " integrations/${ aws_apigatewayv2_integration . proxy . id } "
122117}
123118
124- resource aws_apigatewayv2_route head_health {
119+ resource " aws_apigatewayv2_route" " head_health" {
125120 api_id = local. http_api . id
126121 route_key = " HEAD ${ local . http_api . route_prefix } health"
127122 authorization_type = " NONE"
128123 target = " integrations/${ aws_apigatewayv2_integration . proxy . id } "
129124}
130125
131- resource aws_apigatewayv2_route get_oauth {
126+ resource " aws_apigatewayv2_route" " get_oauth" {
132127 api_id = local. http_api . id
133128 route_key = " GET ${ local . http_api . route_prefix } oauth"
134129 authorization_type = " NONE"
135130 target = " integrations/${ aws_apigatewayv2_integration . proxy . id } "
136131}
137132
138- resource aws_apigatewayv2_route get_oauth_v2 {
133+ resource " aws_apigatewayv2_route" " get_oauth_v2" {
139134 api_id = local. http_api . id
140135 route_key = " GET ${ local . http_api . route_prefix } oauth/v2"
141136 authorization_type = " NONE"
142137 target = " integrations/${ aws_apigatewayv2_integration . proxy . id } "
143138}
144139
145- resource aws_apigatewayv2_route post_slash_cmd {
140+ resource " aws_apigatewayv2_route" " post_slash_cmd" {
146141 api_id = local. http_api . id
147142 route_key = " POST ${ local . http_api . route_prefix } slash/{proxy+}"
148143 authorization_type = " NONE"
@@ -151,15 +146,15 @@ resource aws_apigatewayv2_route post_slash_cmd {
151146
152147# LOG GROUPS
153148
154- resource aws_cloudwatch_log_group logs {
149+ resource " aws_cloudwatch_log_group" " logs" {
155150 name = " /aws/lambda/${ aws_lambda_function . api . function_name } "
156151 retention_in_days = local. log_group . retention_in_days
157152 tags = local. log_group . tags
158153}
159154
160155# LAMBDA FUNCTIONS
161156
162- resource aws_lambda_function api {
157+ resource " aws_lambda_function" " api" {
163158 description = local. lambda . description
164159 filename = local. lambda . filename
165160 function_name = local. lambda . function_name
@@ -185,17 +180,17 @@ resource aws_lambda_function api {
185180
186181# SNS TOPIC
187182
188- resource aws_sns_topic topic {
183+ resource " aws_sns_topic" " topic" {
189184 name = local. topic . name
190185}
191186
192187# IAM
193188
194- data aws_secretsmanager_secret secret {
189+ data " aws_secretsmanager_secret" " secret" {
195190 name = local. secret . name
196191}
197192
198- data aws_iam_policy_document assume_role {
193+ data " aws_iam_policy_document" " assume_role" {
199194 statement {
200195 actions = [" sts:AssumeRole" ]
201196
@@ -206,7 +201,7 @@ data aws_iam_policy_document assume_role {
206201 }
207202}
208203
209- data aws_iam_policy_document api {
204+ data " aws_iam_policy_document" " api" {
210205 statement {
211206 sid = " DecryptKmsKey"
212207 actions = [" kms:Decrypt" ]
@@ -238,21 +233,21 @@ data aws_iam_policy_document api {
238233 }
239234}
240235
241- resource aws_iam_role role {
236+ resource " aws_iam_role" " role" {
242237 assume_role_policy = data. aws_iam_policy_document . assume_role . json
243238 description = local. role . description
244239 name = local. role . name
245240 path = local. role . path
246241 tags = local. role . tags
247242}
248243
249- resource aws_iam_role_policy api {
244+ resource " aws_iam_role_policy" " api" {
250245 name = " api"
251246 role = aws_iam_role. role . id
252247 policy = data. aws_iam_policy_document . api . json
253248}
254249
255- resource aws_lambda_permission invoke_api {
250+ resource " aws_lambda_permission" " invoke_api" {
256251 count = length (local. lambda . permissions )
257252 action = " lambda:InvokeFunction"
258253 function_name = aws_lambda_function. api . arn
0 commit comments