File tree Expand file tree Collapse file tree 3 files changed +30
-1
lines changed
Expand file tree Collapse file tree 3 files changed +30
-1
lines changed Original file line number Diff line number Diff line change @@ -9,10 +9,31 @@ resource "aws_api_gateway_rest_api" "api" {
99 tags = module. this . tags
1010}
1111
12+ resource "aws_api_gateway_method" "placeholder" {
13+ for_each = toset (local. stages )
14+ rest_api_id = aws_api_gateway_rest_api. api [each . key ]. id
15+ resource_id = aws_api_gateway_rest_api. api [each . key ]. root_resource_id
16+ http_method = " GET"
17+ authorization = " NONE"
18+ }
19+
20+ resource "aws_api_gateway_integration" "placeholder" {
21+ for_each = toset (local. stages )
22+ rest_api_id = aws_api_gateway_rest_api. api [each . key ]. id
23+ resource_id = aws_api_gateway_rest_api. api [each . key ]. root_resource_id
24+ http_method = aws_api_gateway_method. placeholder [each . key ]. http_method
25+ type = " MOCK"
26+ }
27+
1228resource "aws_api_gateway_deployment" "placeholder" {
1329 for_each = toset (local. stages )
1430 rest_api_id = aws_api_gateway_rest_api. api [each . key ]. id
1531
32+ depends_on = [
33+ aws_api_gateway_method . placeholder ,
34+ aws_api_gateway_integration . placeholder
35+ ]
36+
1637 lifecycle {
1738 create_before_destroy = true
1839 }
@@ -49,6 +70,8 @@ resource "aws_api_gateway_usage_plan" "default" {
4970 }
5071 }
5172
73+ depends_on = [aws_api_gateway_stage . stage ]
74+
5275 tags = module. this . tags
5376}
5477
Original file line number Diff line number Diff line change 11locals {
2- ssm_prefix = " /${ module . this . namespace } /${ module . this . name } "
2+ ssm_prefix = var . ssm_prefix != null ? var . ssm_prefix : " /${ module . this . namespace } /${ module . this . name } "
33}
44
55resource "aws_ssm_parameter" "rest_api_id" {
Original file line number Diff line number Diff line change @@ -2,4 +2,10 @@ variable "stages" {
22 type = list (string )
33 description = " List of API stages to create"
44 default = [" staging" , " prod" ]
5+ }
6+
7+ variable "ssm_prefix" {
8+ type = string
9+ description = " SSM parameter prefix for storing API resource references"
10+ default = null
511}
You can’t perform that action at this time.
0 commit comments