Skip to content

Commit

Permalink
fix: update metadata and fix neg creation in modules/backend (#463)
Browse files Browse the repository at this point in the history
  • Loading branch information
q2w authored Oct 30, 2024
1 parent 93771df commit 1ed89f0
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 26 deletions.
2 changes: 1 addition & 1 deletion modules/backend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ This module creates `google_compute_backend_service` resource and its dependenci
| firewall\_projects | Names of the projects to create firewall rules in | `list(string)` | <pre>[<br> "default"<br>]</pre> | no |
| 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 |
| 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 |
| 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 |
| 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 |
| 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 |
| 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 |
| locality\_lb\_policy | The load balancing algorithm used within the scope of the locality. | `string` | `null` | no |
Expand Down
8 changes: 4 additions & 4 deletions modules/backend/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -169,22 +169,22 @@ resource "google_compute_region_network_endpoint_group" "serverless_negs" {
dynamic "cloud_run" {
for_each = each.value.type == "cloud-run" ? [1] : []
content {
service = each.value.service.name
service = each.value.service_name
}
}

dynamic "cloud_function" {
for_each = each.value.type == "cloud-function" ? [1] : []
content {
function = each.value.service.name
function = each.value.service_name
}
}

dynamic "app_engine" {
for_each = each.value.type == "app-engine" ? [1] : []
content {
service = each.value.service.name
version = each.value.service.version
service = each.value.service_name
version = each.value.service_version
}
}

Expand Down
18 changes: 11 additions & 7 deletions modules/backend/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ spec:
}))
defaultValue: []
connections:
source:
- source:
source: github.com/terraform-google-modules/terraform-google-vm//modules/mig
version: ~> 12.0
spec:
Expand All @@ -167,11 +167,11 @@ spec:
}))
defaultValue: []
connections:
source:
- source:
source: github.com/GoogleCloudPlatform/terraform-google-cloud-run//modules/v2
version: ~> 0.12
version: ~> 0.13
spec:
outputExpr: '{"region": location, "service_name": service_name, "type": "cloud-run"}'
outputExpr: '{"region": location, "service_name": service_name, "type": "cloud-run", "service_version": ""}'
- name: iap_config
description: Settings for enabling Cloud Identity Aware Proxy Structure.
varType: |-
Expand Down Expand Up @@ -258,7 +258,11 @@ spec:
varType: string
- name: host_path_mappings
description: The list of host/path for which traffic could be sent to the backend service
varType: "list(object({ host : string, path : string }))"
varType: |-
list(object({
host = string
path = string
}))
defaultValue:
- host: "*"
path: /*
Expand Down Expand Up @@ -287,8 +291,8 @@ spec:
- list
- - object
- host: string
- path: string
- backend_service: string
path: string
backend_service: string
requirements:
roles:
- level: Project
Expand Down
7 changes: 5 additions & 2 deletions modules/backend/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,11 @@ variable "security_policy" {

variable "host_path_mappings" {
description = "The list of host/path for which traffic could be sent to the backend service"
type = list(object({ host : string, path : string }))
default = [{ host : "*", path : "/*" }]
type = list(object({
host = string
path = string
}))
default = [{ host : "*", path : "/*" }]
}

variable "firewall_networks" {
Expand Down
2 changes: 1 addition & 1 deletion modules/frontend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ This module creates `HTTP(S) forwarding rule` and its dependencies. This modules
| 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 |
| ssl\_certificates | SSL cert self\_link list. Requires `ssl` to be set to `true` | `list(string)` | `[]` | no |
| ssl\_policy | Selfink to SSL Policy | `string` | `null` | no |
| 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 |
| 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 |
| url\_map\_resource\_uri | The url\_map resource to use. Default is to send all traffic to first backend. | `string` | `null` | no |

## Outputs
Expand Down
16 changes: 8 additions & 8 deletions modules/frontend/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -102,17 +102,17 @@ spec:
description: List of host, path and backend service for creating url_map
varType: |-
list(object({
host : string
path : string
backend_service : string
host = string
path = string
backend_service = string
}))
defaultValue: []
connections:
source:
source: github.com/GoogleCloudPlatform/terraform-google-lb-http//modules/backend
version: ">= 12.0"
spec:
outputExpr: backend_service_info
- source:
source: github.com/terraform-google-modules/terraform-google-lb-http//modules/backend
version: ~> 12.0
spec:
outputExpr: backend_service_info
- name: url_map_resource_uri
description: The url_map resource to use. Default is to send all traffic to first backend.
varType: string
Expand Down
6 changes: 3 additions & 3 deletions modules/frontend/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ variable "create_url_map" {
variable "url_map_input" {
description = "List of host, path and backend service for creating url_map"
type = list(object({
host : string
path : string
backend_service : string
host = string
path = string
backend_service = string
}))
default = []
}
Expand Down

0 comments on commit 1ed89f0

Please sign in to comment.