Skip to content

Commit e15f3fc

Browse files
authored
make resource standalone, remove for loop (#32)
1 parent e9f1faa commit e15f3fc

File tree

2 files changed

+23
-7
lines changed

2 files changed

+23
-7
lines changed

modules/gateway_response/main.tf

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
resource "aws_api_gateway_gateway_response" "wrapper" {
2-
for_each = var.gateway_responses
3-
1+
resource "aws_api_gateway_gateway_response" "this" {
42
rest_api_id = var.rest_api_id
5-
response_type = each.key
6-
status_code = each.value.status_code
3+
response_type = var.response_type
4+
status_code = var.status_code
75

8-
response_templates = each.value.response_templates
9-
response_parameters = each.value.response_parameters
6+
response_templates = var.gateway_responses
7+
response_parameters = var.response_parameters
108
}

modules/gateway_response/variables.tf

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,26 @@ variable "rest_api_id" {
44
default = ""
55
}
66

7+
variable "response_type" {
8+
description = "The response type of the gateway response"
9+
type = string
10+
default = ""
11+
}
12+
13+
variable "status_code" {
14+
description = "The status code of the gateway response"
15+
type = string
16+
default = ""
17+
}
18+
719
variable "gateway_responses" {
820
description = "map of gateway responses"
921
type = map(any)
1022
default = {}
1123
}
24+
25+
variable "response_parameters" {
26+
description = "map of response parameters"
27+
type = map(any)
28+
default = {}
29+
}

0 commit comments

Comments
 (0)