Skip to content

Commit 1ed89f0

Browse files
authored
fix: update metadata and fix neg creation in modules/backend (#463)
1 parent 93771df commit 1ed89f0

File tree

7 files changed

+33
-26
lines changed

7 files changed

+33
-26
lines changed

modules/backend/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ This module creates `google_compute_backend_service` resource and its dependenci
1919
| firewall\_projects | Names of the projects to create firewall rules in | `list(string)` | <pre>[<br> "default"<br>]</pre> | no |
2020
| groups | The list of backend instance group which serves the traffic. | <pre>list(object({<br> group = string<br> description = optional(string)<br><br> balancing_mode = optional(string)<br> capacity_scaler = optional(number)<br> max_connections = optional(number)<br> max_connections_per_instance = optional(number)<br> max_connections_per_endpoint = optional(number)<br> max_rate = optional(number)<br> max_rate_per_instance = optional(number)<br> max_rate_per_endpoint = optional(number)<br> max_utilization = optional(number)<br> }))</pre> | `[]` | no |
2121
| health\_check | Input for creating HttpHealthCheck or HttpsHealthCheck resource for health checking this BackendService. A health check must be specified unless the backend service uses an internet or serverless NEG as a backend. | <pre>object({<br> host = optional(string, null)<br> request_path = optional(string, null)<br> request = optional(string, null)<br> response = optional(string, null)<br> port = optional(number, null)<br> port_name = optional(string, null)<br> proxy_header = optional(string, null)<br> port_specification = optional(string, null)<br> protocol = optional(string, null)<br> check_interval_sec = optional(number, 5)<br> timeout_sec = optional(number, 5)<br> healthy_threshold = optional(number, 2)<br> unhealthy_threshold = optional(number, 2)<br> logging = optional(bool, false)<br> })</pre> | `null` | no |
22-
| host\_path\_mappings | The list of host/path for which traffic could be sent to the backend service | `list(object({ host : string, path : string }))` | <pre>[<br> {<br> "host": "*",<br> "path": "/*"<br> }<br>]</pre> | no |
22+
| host\_path\_mappings | The list of host/path for which traffic could be sent to the backend service | <pre>list(object({<br> host = string<br> path = string<br> }))</pre> | <pre>[<br> {<br> "host": "*",<br> "path": "/*"<br> }<br>]</pre> | no |
2323
| iap\_config | Settings for enabling Cloud Identity Aware Proxy Structure. | <pre>object({<br> enable = bool<br> oauth2_client_id = optional(string)<br> oauth2_client_secret = optional(string)<br> })</pre> | <pre>{<br> "enable": false<br>}</pre> | no |
2424
| load\_balancing\_scheme | Load balancing scheme type (EXTERNAL for classic external load balancer, EXTERNAL\_MANAGED for Envoy-based load balancer, and INTERNAL\_SELF\_MANAGED for traffic director). | `string` | `"EXTERNAL_MANAGED"` | no |
2525
| locality\_lb\_policy | The load balancing algorithm used within the scope of the locality. | `string` | `null` | no |

modules/backend/main.tf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,22 +169,22 @@ resource "google_compute_region_network_endpoint_group" "serverless_negs" {
169169
dynamic "cloud_run" {
170170
for_each = each.value.type == "cloud-run" ? [1] : []
171171
content {
172-
service = each.value.service.name
172+
service = each.value.service_name
173173
}
174174
}
175175

176176
dynamic "cloud_function" {
177177
for_each = each.value.type == "cloud-function" ? [1] : []
178178
content {
179-
function = each.value.service.name
179+
function = each.value.service_name
180180
}
181181
}
182182

183183
dynamic "app_engine" {
184184
for_each = each.value.type == "app-engine" ? [1] : []
185185
content {
186-
service = each.value.service.name
187-
version = each.value.service.version
186+
service = each.value.service_name
187+
version = each.value.service_version
188188
}
189189
}
190190

modules/backend/metadata.yaml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ spec:
151151
}))
152152
defaultValue: []
153153
connections:
154-
source:
154+
- source:
155155
source: github.com/terraform-google-modules/terraform-google-vm//modules/mig
156156
version: ~> 12.0
157157
spec:
@@ -167,11 +167,11 @@ spec:
167167
}))
168168
defaultValue: []
169169
connections:
170-
source:
170+
- source:
171171
source: github.com/GoogleCloudPlatform/terraform-google-cloud-run//modules/v2
172-
version: ~> 0.12
172+
version: ~> 0.13
173173
spec:
174-
outputExpr: '{"region": location, "service_name": service_name, "type": "cloud-run"}'
174+
outputExpr: '{"region": location, "service_name": service_name, "type": "cloud-run", "service_version": ""}'
175175
- name: iap_config
176176
description: Settings for enabling Cloud Identity Aware Proxy Structure.
177177
varType: |-
@@ -258,7 +258,11 @@ spec:
258258
varType: string
259259
- name: host_path_mappings
260260
description: The list of host/path for which traffic could be sent to the backend service
261-
varType: "list(object({ host : string, path : string }))"
261+
varType: |-
262+
list(object({
263+
host = string
264+
path = string
265+
}))
262266
defaultValue:
263267
- host: "*"
264268
path: /*
@@ -287,8 +291,8 @@ spec:
287291
- list
288292
- - object
289293
- host: string
290-
- path: string
291-
- backend_service: string
294+
path: string
295+
backend_service: string
292296
requirements:
293297
roles:
294298
- level: Project

modules/backend/variables.tf

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,11 @@ variable "security_policy" {
239239

240240
variable "host_path_mappings" {
241241
description = "The list of host/path for which traffic could be sent to the backend service"
242-
type = list(object({ host : string, path : string }))
243-
default = [{ host : "*", path : "/*" }]
242+
type = list(object({
243+
host = string
244+
path = string
245+
}))
246+
default = [{ host : "*", path : "/*" }]
244247
}
245248

246249
variable "firewall_networks" {

modules/frontend/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ This module creates `HTTP(S) forwarding rule` and its dependencies. This modules
3333
| ssl | Set to `true` to enable SSL support. If `true` then at least one of these are required: 1) `ssl_certificates` OR 2) `create_ssl_certificate` set to `true` and `private_key/certificate` OR 3) `managed_ssl_certificate_domains`, OR 4) `certificate_map` | `bool` | `false` | no |
3434
| ssl\_certificates | SSL cert self\_link list. Requires `ssl` to be set to `true` | `list(string)` | `[]` | no |
3535
| ssl\_policy | Selfink to SSL Policy | `string` | `null` | no |
36-
| url\_map\_input | List of host, path and backend service for creating url\_map | <pre>list(object({<br> host : string<br> path : string<br> backend_service : string<br> }))</pre> | `[]` | no |
36+
| url\_map\_input | List of host, path and backend service for creating url\_map | <pre>list(object({<br> host = string<br> path = string<br> backend_service = string<br> }))</pre> | `[]` | no |
3737
| url\_map\_resource\_uri | The url\_map resource to use. Default is to send all traffic to first backend. | `string` | `null` | no |
3838

3939
## Outputs

modules/frontend/metadata.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -102,17 +102,17 @@ spec:
102102
description: List of host, path and backend service for creating url_map
103103
varType: |-
104104
list(object({
105-
host : string
106-
path : string
107-
backend_service : string
105+
host = string
106+
path = string
107+
backend_service = string
108108
}))
109109
defaultValue: []
110110
connections:
111-
source:
112-
source: github.com/GoogleCloudPlatform/terraform-google-lb-http//modules/backend
113-
version: ">= 12.0"
114-
spec:
115-
outputExpr: backend_service_info
111+
- source:
112+
source: github.com/terraform-google-modules/terraform-google-lb-http//modules/backend
113+
version: ~> 12.0
114+
spec:
115+
outputExpr: backend_service_info
116116
- name: url_map_resource_uri
117117
description: The url_map resource to use. Default is to send all traffic to first backend.
118118
varType: string

modules/frontend/variables.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ variable "create_url_map" {
6464
variable "url_map_input" {
6565
description = "List of host, path and backend service for creating url_map"
6666
type = list(object({
67-
host : string
68-
path : string
69-
backend_service : string
67+
host = string
68+
path = string
69+
backend_service = string
7070
}))
7171
default = []
7272
}

0 commit comments

Comments
 (0)