2023-06-26 00:50:10 -07:00
# Internal Application Load Balancer Module
2022-04-04 23:58:55 -07:00
2022-11-14 05:39:00 -08:00
This module allows managing Internal HTTP/HTTPS Load Balancers (L7 ILBs). It's designed to expose the full configuration of the underlying resources, and to facilitate common usage patterns by providing sensible defaults, and optionally managing prerequisite resources like health checks, instance groups, etc.
2023-05-15 23:11:34 -07:00
Due to the complexity of the underlying resources, changes to the configuration that involve recreation of resources are best applied in stages, starting by disabling the configuration in the urlmap that references the resources that need recreation, then doing the same for the backend service, etc.
2022-04-04 23:58:55 -07:00
## Examples
2023-07-28 06:43:51 -07:00
<!-- BEGIN TOC -->
- [Examples ](#examples )
- [Minimal Example ](#minimal-example )
- [Cross-project backend services ](#cross-project-backend-services )
- [Health Checks ](#health-checks )
- [Instance Groups ](#instance-groups )
- [Network Endpoint Groups (NEGs) ](#network-endpoint-groups-negs )
- [Zonal NEG creation ](#zonal-neg-creation )
- [Hybrid NEG creation ](#hybrid-neg-creation )
- [Serverless NEG creation ](#serverless-neg-creation )
- [Private Service Connect NEG creation ](#private-service-connect-neg-creation )
- [URL Map ](#url-map )
- [SSL Certificates ](#ssl-certificates )
- [Complex example ](#complex-example )
- [Files ](#files )
- [Variables ](#variables )
- [Outputs ](#outputs )
<!-- END TOC -->
2022-11-18 00:48:41 -08:00
2022-04-04 23:58:55 -07:00
### Minimal Example
An HTTP ILB with a backend service pointing to a GCE instance group:
```hcl
2022-11-14 05:39:00 -08:00
module "ilb-l7" {
2023-06-26 00:50:10 -07:00
source = "./fabric/modules/net-lb-app-int"
2022-04-04 23:58:55 -07:00
name = "ilb-test"
project_id = var.project_id
region = "europe-west1"
2022-11-14 05:39:00 -08:00
backend_service_configs = {
default = {
backends = [{
group = "projects/myprj/zones/europe-west1-a/instanceGroups/my-ig"
}]
2022-04-04 23:58:55 -07:00
}
}
2022-11-14 05:39:00 -08:00
vpc_config = {
network = var.vpc.self_link
subnetwork = var.subnet.self_link
}
2022-04-04 23:58:55 -07:00
}
# tftest modules=1 resources=5
```
2022-11-14 05:39:00 -08:00
An HTTPS ILB needs a few additional fields:
2022-04-04 23:58:55 -07:00
```hcl
2022-11-14 05:39:00 -08:00
module "ilb-l7" {
2023-06-26 00:50:10 -07:00
source = "./fabric/modules/net-lb-app-int"
2022-04-04 23:58:55 -07:00
name = "ilb-test"
project_id = var.project_id
region = "europe-west1"
2022-11-14 05:39:00 -08:00
backend_service_configs = {
default = {
backends = [{
group = "projects/myprj/zones/europe-west1-a/instanceGroups/my-ig"
}]
2022-04-04 23:58:55 -07:00
}
}
2022-11-14 05:39:00 -08:00
protocol = "HTTPS"
ssl_certificates = {
certificate_ids = [
"projects/myprj/regions/europe-west1/sslCertificates/my-cert"
]
}
vpc_config = {
network = var.vpc.self_link
subnetwork = var.subnet.self_link
}
2022-04-04 23:58:55 -07:00
}
# tftest modules=1 resources=5
```
2022-11-18 00:48:41 -08:00
### Cross-project backend services
2022-04-04 23:58:55 -07:00
2022-11-18 00:48:41 -08:00
When using Shared VPC, this module also allows configuring [cross-project backend services ](https://cloud.google.com/load-balancing/docs/l7-internal/l7-internal-shared-vpc#cross-project ):
2022-04-04 23:58:55 -07:00
```hcl
2022-11-14 05:39:00 -08:00
module "ilb-l7" {
2023-06-26 00:50:10 -07:00
source = "./fabric/modules/net-lb-app-int"
2022-04-04 23:58:55 -07:00
name = "ilb-test"
2022-11-18 00:48:41 -08:00
project_id = "prj-host"
2022-04-04 23:58:55 -07:00
region = "europe-west1"
2022-11-14 05:39:00 -08:00
backend_service_configs = {
default = {
2022-11-18 00:48:41 -08:00
project_id = "prj-svc"
2022-11-14 05:39:00 -08:00
backends = [{
2022-11-18 00:48:41 -08:00
group = "projects/prj-svc/zones/europe-west1-a/instanceGroups/my-ig"
2022-11-14 05:39:00 -08:00
}]
2022-04-04 23:58:55 -07:00
}
}
2022-11-14 05:39:00 -08:00
health_check_configs = {
2022-11-18 00:48:41 -08:00
default = {
project_id = "prj-svc"
http = {
port_specification = "USE_SERVING_PORT"
}
2022-04-04 23:58:55 -07:00
}
}
2022-11-14 05:39:00 -08:00
vpc_config = {
network = var.vpc.self_link
subnetwork = var.subnet.self_link
}
2022-04-04 23:58:55 -07:00
}
# tftest modules=1 resources=5
```
2022-11-18 00:48:41 -08:00
### Health Checks
You can leverage externally defined health checks for backend services, or have the module create them for you. By default a simple HTTP health check is created, and used in backend services.
Health check configuration is controlled via the `health_check_configs` variable, which behaves in a similar way to other LB modules in this repository.
2023-05-15 23:11:34 -07:00
Defining different health checks from the default is very easy. You can for example replace the default HTTP health check with a TCP one and reference it in you backend service:
2022-04-04 23:58:55 -07:00
```hcl
2022-11-14 05:39:00 -08:00
module "ilb-l7" {
2023-06-26 00:50:10 -07:00
source = "./fabric/modules/net-lb-app-int"
2022-04-04 23:58:55 -07:00
name = "ilb-test"
project_id = var.project_id
region = "europe-west1"
2022-11-14 05:39:00 -08:00
backend_service_configs = {
default = {
backends = [{
group = "projects/myprj/zones/europe-west1-a/instanceGroups/my-ig"
}]
2022-11-18 00:48:41 -08:00
health_checks = ["custom-tcp"]
}
}
health_check_configs = {
custom-tcp = {
tcp = { port = 80 }
2022-04-04 23:58:55 -07:00
}
}
2022-11-14 05:39:00 -08:00
vpc_config = {
network = var.vpc.self_link
subnetwork = var.subnet.self_link
}
2022-04-04 23:58:55 -07:00
}
2022-11-18 00:48:41 -08:00
# tftest modules=1 resources=5
2022-04-04 23:58:55 -07:00
```
2022-11-18 00:48:41 -08:00
To leverage existing health checks without having the module create them, simply pass their self links to backend services and set the `health_check_configs` variable to an empty map:
2022-04-04 23:58:55 -07:00
2022-11-14 05:39:00 -08:00
```hcl
module "ilb-l7" {
2023-06-26 00:50:10 -07:00
source = "./fabric/modules/net-lb-app-int"
2022-04-04 23:58:55 -07:00
name = "ilb-test"
project_id = var.project_id
region = "europe-west1"
2022-11-14 05:39:00 -08:00
backend_service_configs = {
default = {
backends = [{
group = "projects/myprj/zones/europe-west1-a/instanceGroups/my-ig"
}]
2022-11-18 00:48:41 -08:00
health_checks = ["projects/myprj/global/healthChecks/custom"]
2022-11-14 05:39:00 -08:00
}
2022-04-04 23:58:55 -07:00
}
2022-11-18 00:48:41 -08:00
health_check_configs = {}
2022-11-14 05:39:00 -08:00
vpc_config = {
network = var.vpc.self_link
subnetwork = var.subnet.self_link
}
2022-04-04 23:58:55 -07:00
}
2022-11-18 00:48:41 -08:00
# tftest modules=1 resources=4
2022-04-04 23:58:55 -07:00
```
2022-11-14 05:39:00 -08:00
### Instance Groups
2022-04-04 23:58:55 -07:00
2022-11-14 05:39:00 -08:00
The module can optionally create unmanaged instance groups, which can then be referred to in backends via their key:
2022-04-04 23:58:55 -07:00
```hcl
2022-11-14 05:39:00 -08:00
module "ilb-l7" {
2023-06-26 00:50:10 -07:00
source = "./fabric/modules/net-lb-app-int"
2022-04-04 23:58:55 -07:00
name = "ilb-test"
project_id = var.project_id
region = "europe-west1"
2022-11-14 05:39:00 -08:00
backend_service_configs = {
default = {
port_name = "http"
2022-12-16 03:53:56 -08:00
backends = [
2022-11-14 05:39:00 -08:00
{ group = "default" }
]
}
2022-04-04 23:58:55 -07:00
}
2022-11-14 05:39:00 -08:00
group_configs = {
default = {
zone = "europe-west1-b"
instances = [
"projects/myprj/zones/europe-west1-b/instances/vm-a"
]
named_ports = { http = 80 }
2022-04-04 23:58:55 -07:00
}
}
2022-11-14 05:39:00 -08:00
vpc_config = {
network = var.vpc.self_link
subnetwork = var.subnet.self_link
}
2022-04-04 23:58:55 -07:00
}
# tftest modules=1 resources=6
```
2022-11-14 05:39:00 -08:00
### Network Endpoint Groups (NEGs)
2022-04-04 23:58:55 -07:00
2022-11-16 05:14:05 -08:00
Network Endpoint Groups (NEGs) can be used as backends, by passing their id as the backend group in a backends service configuration:
2022-04-04 23:58:55 -07:00
```hcl
2022-11-14 05:39:00 -08:00
module "ilb-l7" {
2023-06-26 00:50:10 -07:00
source = "./fabric/modules/net-lb-app-int"
2022-04-04 23:58:55 -07:00
name = "ilb-test"
project_id = var.project_id
region = "europe-west1"
2022-11-14 05:39:00 -08:00
backend_service_configs = {
default = {
backends = [{
balancing_mode = "RATE"
group = "projects/myprj/zones/europe-west1-a/networkEndpointGroups/my-neg"
max_rate = { per_endpoint = 1 }
}]
2022-04-04 23:58:55 -07:00
}
}
2022-11-14 05:39:00 -08:00
vpc_config = {
network = var.vpc.self_link
subnetwork = var.subnet.self_link
}
2022-04-04 23:58:55 -07:00
}
# tftest modules=1 resources=5
```
2023-06-07 09:57:54 -07:00
Similarly to instance groups, NEGs can also be managed by this module which supports GCE, hybrid, serverless and Private Service Connect NEGs:
#### Zonal NEG creation
2022-04-04 23:58:55 -07:00
```hcl
2022-12-21 08:04:56 -08:00
resource "google_compute_address" "test" {
2023-10-03 05:15:36 -07:00
project = var.project_id
2022-12-21 08:04:56 -08:00
name = "neg-test"
subnetwork = var.subnet.self_link
address_type = "INTERNAL"
address = "10.0.0.10"
region = "europe-west1"
}
2022-11-14 05:39:00 -08:00
module "ilb-l7" {
2023-06-26 00:50:10 -07:00
source = "./fabric/modules/net-lb-app-int"
2022-04-04 23:58:55 -07:00
name = "ilb-test"
project_id = var.project_id
region = "europe-west1"
2022-11-14 05:39:00 -08:00
backend_service_configs = {
default = {
backends = [{
balancing_mode = "RATE"
2022-12-16 03:53:56 -08:00
group = "my-neg"
2022-11-14 05:39:00 -08:00
max_rate = { per_endpoint = 1 }
}]
2022-04-04 23:58:55 -07:00
}
}
2022-11-14 05:39:00 -08:00
neg_configs = {
my-neg = {
2022-11-16 05:14:05 -08:00
gce = {
2022-12-16 03:53:56 -08:00
zone = "europe-west1-b"
2022-12-21 08:04:56 -08:00
endpoints = {
e-0 = {
instance = "test-1"
ip_address = google_compute_address.test.address
# ip_address = "10.0.0.10"
port = 80
}
}
2022-11-16 05:14:05 -08:00
}
2022-11-14 05:39:00 -08:00
}
}
vpc_config = {
network = var.vpc.self_link
subnetwork = var.subnet.self_link
2022-04-04 23:58:55 -07:00
}
2022-11-14 05:39:00 -08:00
}
2022-12-21 08:04:56 -08:00
# tftest modules=1 resources=8
2022-11-14 05:39:00 -08:00
```
2022-04-04 23:58:55 -07:00
2023-06-07 09:57:54 -07:00
#### Hybrid NEG creation
2022-11-14 05:39:00 -08:00
```hcl
module "ilb-l7" {
2023-06-26 00:50:10 -07:00
source = "./fabric/modules/net-lb-app-int"
2022-11-14 05:39:00 -08:00
name = "ilb-test"
project_id = var.project_id
region = "europe-west1"
backend_service_configs = {
default = {
2023-06-08 03:05:54 -07:00
backends = [{ group = "my-neg" }]
2022-04-04 23:58:55 -07:00
}
}
2022-11-14 05:39:00 -08:00
neg_configs = {
my-neg = {
2022-11-16 05:14:05 -08:00
hybrid = {
2022-12-16 03:53:56 -08:00
zone = "europe-west1-b"
2022-12-21 08:04:56 -08:00
endpoints = {
e-0 = {
ip_address = "10.0.0.10"
port = 80
}
}
2022-11-16 05:14:05 -08:00
}
2022-11-14 05:39:00 -08:00
}
}
vpc_config = {
network = var.vpc.self_link
subnetwork = var.subnet.self_link
}
2022-04-04 23:58:55 -07:00
}
2022-11-14 05:39:00 -08:00
# tftest modules=1 resources=7
```
2022-04-04 23:58:55 -07:00
2023-06-07 09:57:54 -07:00
#### Serverless NEG creation
2022-11-16 05:14:05 -08:00
```hcl
module "ilb-l7" {
2023-06-26 00:50:10 -07:00
source = "./fabric/modules/net-lb-app-int"
2022-11-16 05:14:05 -08:00
name = "ilb-test"
project_id = var.project_id
region = "europe-west1"
backend_service_configs = {
default = {
backends = [{
2023-10-24 00:25:43 -07:00
group = "my-neg"
2022-11-16 05:14:05 -08:00
}]
2023-02-24 02:13:55 -08:00
health_checks = []
2022-11-16 05:14:05 -08:00
}
}
2023-02-24 02:13:55 -08:00
health_check_configs = {}
2022-11-16 05:14:05 -08:00
neg_configs = {
my-neg = {
cloudrun = {
region = "europe-west1"
target_service = {
2022-11-16 05:14:43 -08:00
name = "my-run-service"
2022-11-16 05:14:05 -08:00
}
}
}
}
vpc_config = {
network = var.vpc.self_link
subnetwork = var.subnet.self_link
}
}
2023-02-24 02:13:55 -08:00
# tftest modules=1 resources=5
2022-11-16 05:14:05 -08:00
```
2023-06-07 09:57:54 -07:00
#### Private Service Connect NEG creation
```hcl
module "ilb-l7" {
2023-06-26 00:50:10 -07:00
source = "./fabric/modules/net-lb-app-int"
2023-06-07 09:57:54 -07:00
name = "ilb-test"
project_id = var.project_id
region = "europe-west1"
backend_service_configs = {
default = {
backends = [{
group = "my-neg"
}]
health_checks = []
}
}
health_check_configs = {}
neg_configs = {
my-neg = {
psc = {
region = "europe-west1"
target_service = "europe-west1-cloudkms.googleapis.com"
}
}
}
vpc_config = {
network = var.vpc.self_link
subnetwork = var.subnet.self_link
}
}
# tftest modules=1 resources=5
```
2022-11-14 05:39:00 -08:00
### URL Map
2022-04-04 23:58:55 -07:00
2022-11-14 05:39:00 -08:00
The module exposes the full URL map resource configuration, with some minor changes to the interface to decrease verbosity, and support for aliasing backend services via keys.
The default URL map configuration sets the `default` backend service as the default service for the load balancer as a convenience. Just override the `urlmap_config` variable to change the default behaviour:
```hcl
module "ilb-l7" {
2023-06-26 00:50:10 -07:00
source = "./fabric/modules/net-lb-app-int"
2022-11-14 05:39:00 -08:00
name = "ilb-test"
project_id = var.project_id
region = "europe-west1"
backend_service_configs = {
default = {
backends = [{
group = "projects/myprj/zones/europe-west1-a/instanceGroups/my-ig"
}]
}
video = {
backends = [{
group = "projects/myprj/zones/europe-west1-a/instanceGroups/my-ig-2"
}]
}
}
urlmap_config = {
default_service = "default"
host_rules = [{
hosts = ["*"]
path_matcher = "pathmap"
}]
path_matchers = {
pathmap = {
default_service = "default"
path_rules = [{
2022-12-16 03:53:56 -08:00
paths = ["/video", "/video/*"]
2022-11-14 05:39:00 -08:00
service = "video"
}]
}
}
}
vpc_config = {
network = var.vpc.self_link
subnetwork = var.subnet.self_link
2022-04-04 23:58:55 -07:00
}
}
2022-11-14 05:39:00 -08:00
# tftest modules=1 resources=6
2022-04-04 23:58:55 -07:00
```
2022-11-18 00:48:41 -08:00
### SSL Certificates
Similarly to health checks, SSL certificates can also be created by the module. In this example we are using private key and certificate resources so that the example test only depends on Terraform providers, but in real use those can be replaced by external files.
```hcl
resource "tls_private_key" "default" {
algorithm = "RSA"
rsa_bits = 4096
}
resource "tls_self_signed_cert" "default" {
private_key_pem = tls_private_key.default.private_key_pem
subject {
common_name = "example.com"
organization = "ACME Examples, Inc"
}
validity_period_hours = 720
allowed_uses = [
"key_encipherment",
"digital_signature",
"server_auth",
]
}
module "ilb-l7" {
2023-06-26 00:50:10 -07:00
source = "./fabric/modules/net-lb-app-int"
2022-11-18 00:48:41 -08:00
name = "ilb-test"
project_id = var.project_id
region = "europe-west1"
backend_service_configs = {
default = {
backends = [{
group = "projects/myprj/zones/europe-west1-a/instanceGroups/my-ig"
}]
}
}
health_check_configs = {
default = {
https = { port = 443 }
}
}
protocol = "HTTPS"
ssl_certificates = {
create_configs = {
default = {
# certificate and key could also be read via file() from external files
certificate = tls_self_signed_cert.default.cert_pem
private_key = tls_private_key.default.private_key_pem
}
}
}
vpc_config = {
network = var.vpc.self_link
subnetwork = var.subnet.self_link
}
}
# tftest modules=1 resources=8
```
2022-11-14 05:39:00 -08:00
### Complex example
2022-04-04 23:58:55 -07:00
2022-11-14 05:39:00 -08:00
This example mixes group and NEG backends, and shows how to set HTTPS for specific backends.
2022-04-04 23:58:55 -07:00
2022-11-14 05:39:00 -08:00
```hcl
module "ilb-l7" {
2023-06-26 00:50:10 -07:00
source = "./fabric/modules/net-lb-app-int"
2022-11-14 05:39:00 -08:00
name = "ilb-l7-test-0"
project_id = "prj-gce"
region = "europe-west8"
backend_service_configs = {
default = {
backends = [
{ group = "nginx-ew8-b" },
{ group = "nginx-ew8-c" },
]
}
gce-neg = {
backends = [{
balancing_mode = "RATE"
group = "neg-nginx-ew8-c"
max_rate = { per_endpoint = 1 }
}]
}
home = {
backends = [{
balancing_mode = "RATE"
group = "neg-home-hello"
max_rate = {
per_endpoint = 1
}
}]
health_checks = ["neg"]
locality_lb_policy = "ROUND_ROBIN"
protocol = "HTTPS"
}
}
group_configs = {
nginx-ew8-b = {
zone = "europe-west8-b"
instances = [
"projects/prj-gce/zones/europe-west8-b/instances/nginx-ew8-b"
]
named_ports = { http = 80 }
}
nginx-ew8-c = {
zone = "europe-west8-c"
instances = [
"projects/prj-gce/zones/europe-west8-c/instances/nginx-ew8-c"
]
named_ports = { http = 80 }
}
}
health_check_configs = {
default = {
http = {
port = 80
}
}
neg = {
https = {
host = "hello.home.example.com"
port = 443
}
}
}
neg_configs = {
neg-nginx-ew8-c = {
2022-11-16 05:14:05 -08:00
gce = {
zone = "europe-west8-c"
2022-12-21 08:04:56 -08:00
endpoints = {
e-0 = {
instance = "nginx-ew8-c"
ip_address = "10.24.32.26"
port = 80
}
}
2022-11-16 05:14:05 -08:00
}
2022-11-14 05:39:00 -08:00
}
neg-home-hello = {
2022-11-16 05:14:05 -08:00
hybrid = {
2022-12-16 03:53:56 -08:00
zone = "europe-west8-b"
2022-12-21 08:04:56 -08:00
endpoints = {
e-0 = {
ip_address = "192.168.0.3"
port = 443
}
}
2022-11-16 05:14:05 -08:00
}
2022-11-14 05:39:00 -08:00
}
}
urlmap_config = {
default_service = "default"
host_rules = [
{
hosts = ["*"]
path_matcher = "gce"
},
{
hosts = ["hello.home.example.com"]
path_matcher = "home"
}
]
path_matchers = {
gce = {
default_service = "default"
path_rules = [
{
paths = ["/gce-neg", "/gce-neg/*"]
service = "gce-neg"
}
]
}
home = {
default_service = "home"
}
}
}
vpc_config = {
network = "projects/prj-host/global/networks/shared-vpc"
subnetwork = "projects/prj-host/regions/europe-west8/subnetworks/gce"
}
}
# tftest modules=1 resources=14
```
2022-04-04 23:58:55 -07:00
<!-- TFDOC OPTS files:1 -->
<!-- BEGIN TFDOC -->
## Files
| name | description | resources |
|---|---|---|
2022-11-14 05:39:00 -08:00
| [backend-service.tf ](./backend-service.tf ) | Backend service resources. | < code > google_compute_region_backend_service</ code > |
2023-06-30 03:18:06 -07:00
| [groups.tf ](./groups.tf ) | None | < code > google_compute_instance_group</ code > |
2022-11-14 05:39:00 -08:00
| [health-check.tf ](./health-check.tf ) | Health check resource. | < code > google_compute_health_check</ code > |
2023-06-30 03:18:06 -07:00
| [main.tf ](./main.tf ) | Module-level locals and resources. | < code > google_compute_forwarding_rule</ code > · < code > google_compute_network_endpoint</ code > · < code > google_compute_network_endpoint_group</ code > · < code > google_compute_region_network_endpoint_group</ code > · < code > google_compute_region_ssl_certificate</ code > · < code > google_compute_region_target_http_proxy</ code > · < code > google_compute_region_target_https_proxy</ code > |
2022-11-24 09:56:01 -08:00
| [outputs.tf ](./outputs.tf ) | Module outputs. | |
2022-11-14 05:39:00 -08:00
| [urlmap.tf ](./urlmap.tf ) | URL map resources. | < code > google_compute_region_url_map</ code > |
| [variables-backend-service.tf ](./variables-backend-service.tf ) | Backend services variables. | |
| [variables-health-check.tf ](./variables-health-check.tf ) | Health check variable. | |
| [variables-urlmap.tf ](./variables-urlmap.tf ) | URLmap variable. | |
2022-04-04 23:58:55 -07:00
| [variables.tf ](./variables.tf ) | Module variables. | |
| [versions.tf ](./versions.tf ) | Version pins. | |
## Variables
| name | description | type | required | default |
|---|---|:---:|:---:|:---:|
2022-11-18 00:48:41 -08:00
| [name ](variables.tf#L54 ) | Load balancer name. | < code > string</ code > | ✓ | |
2023-06-07 09:57:54 -07:00
| [project_id ](variables.tf#L138 ) | Project id. | < code > string</ code > | ✓ | |
| [region ](variables.tf#L156 ) | The region where to allocate the ILB resources. | < code > string</ code > | ✓ | |
| [vpc_config ](variables.tf#L183 ) | VPC-level configuration. | < code title = "object({ network = string subnetwork = string })" > object({…}) </ code > | ✓ | |
2022-11-14 05:39:00 -08:00
| [address ](variables.tf#L17 ) | Optional IP address used for the forwarding rule. | < code > string</ code > | | < code > null</ code > |
2022-11-18 00:48:41 -08:00
| [backend_service_configs ](variables-backend-service.tf#L19 ) | Backend service level configuration. | < code title = "map(object({ affinity_cookie_ttl_sec &# 61 ; optional &# 40 ; number &# 41 ;&# 10 ; connection_draining_timeout_sec &# 61 ; optional &# 40 ; number &# 41 ;&# 10 ; health_checks &# 61 ; optional &# 40 ; list &# 40 ; string &# 41 ;, &# 91 ;&# 34 ; default &# 34 ;&# 93 ;&# 41 ;&# 10 ; locality_lb_policy &# 61 ; optional &# 40 ; string &# 41 ;&# 10 ; log_sample_rate &# 61 ; optional &# 40 ; number &# 41 ;&# 10 ; port_name &# 61 ; optional &# 40 ; string &# 41 ;&# 10 ; project_id &# 61 ; optional &# 40 ; string &# 41 ;&# 10 ; protocol &# 61 ; optional &# 40 ; string &# 41 ;&# 10 ; session_affinity &# 61 ; optional &# 40 ; string &# 41 ;&# 10 ; timeout_sec &# 61 ; optional &# 40 ; number &# 41 ;&# 10 ; backends &# 61 ; list &# 40 ; object &# 40 ;&# 123 ;&# 10 ; group &# 61 ; string &# 10 ; balancing_mode &# 61 ; optional &# 40 ; string , &# 34 ; UTILIZATION &# 34 ;&# 41 ;&# 10 ; capacity_scaler &# 61 ; optional &# 40 ; number , 1 &# 41 ;&# 10 ; description &# 61 ; optional &# 40 ; string , &# 34 ; Terraform managed .&# 34 ;&# 41 ;&# 10 ; failover &# 61 ; optional &# 40 ; bool , false &# 41 ;&# 10 ; max_connections &# 61 ; optional &# 40 ; object &# 40 ;&# 123 ;&# 10 ; per_endpoint &# 61 ; optional &# 40 ; number &# 41 ;&# 10 ; per_group &# 61 ; optional &# 40 ; number &# 41 ;&# 10 ; per_instance &# 61 ; optional &# 40 ; number &# 41 ;&# 10 ; &# 125 ;&# 41 ;&# 41 ;&# 10 ; max_rate &# 61 ; optional &# 40 ; object &# 40 ;&# 123 ;&# 10 ; per_endpoint &# 61 ; optional &# 40 ; number &# 41 ;&# 10 ; per_group &# 61 ; optional &# 40 ; number &# 41 ;&# 10 ; per_instance &# 61 ; optional &# 40 ; number &# 41 ;&# 10 ; &# 125 ;&# 41 ;&# 41 ;&# 10 ; max_utilization &# 61 ; optional &# 40 ; number &# 41 ;&# 10 ; &# 125 ;&# 41 ;&# 41 ;&# 10 ; circuit_breakers &# 61 ; optional &# 40 ; object &# 40 ;&# 123 ;&# 10 ; max_connections &# 61 ; optional &# 40 ; number &# 41 ;&# 10 ; max_pending_requests &# 61 ; optional &# 40 ; number &# 41 ;&# 10 ; max_requests &# 61 ; optional &# 40 ; number &# 41 ;&# 10 ; max_requests_per_connection &# 61 ; optional &# 40 ; number &# 41 ;&# 10 ; max_retries &# 61 ; optional &# 40 ; number &# 41 ;&# 10 ; connect_timeout &# 61 ; optional &# 40 ; object &# 40 ;&# 123 ;&# 10 ; seconds &# 61 ; number &# 10 ; nanos &# 61 ; optional &# 40 ; number &# 41 ;&# 10 ; &# 125 ;&# 41 ;&# 41 ;&# 10 ; &# 125 ;&# 41 ;&# 41 ;&# 10 ; connection_tracking &# 61 ; optional &# 40 ; object &# 40 ;&# 123 ;&# 10 ; idle_timeout_sec &# 61 ; optional &# 40 ; number &# 41 ;&# 10 ; persist_conn_on_unhealthy &# 61 ; optional &# 40 ; string &# 41 ;&# 10 ; track_per_session &# 61 ; optional &# 40 ; bool &# 41 ;&# 10 ; &# 125 ;&# 41 ;&# 41 ;&# 10 ; consistent_hash &# 61 ; optional &# 40 ; object &# 40 ;&# 123 ;&# 10 ; http_header_name &# 61 ; optional &# 40 ; string &# 41 ;&# 10 ; minimum_ring_size &# 61 ; optional &# 40 ; number &# 41 ;&# 10 ; http_cookie &# 61 ; optional &# 40 ; object &# 40 ;&# 123 ;&# 10 ; name &# 61 ; optional &# 40 ; string &# 41 ;&# 10 ; path &# 61 ; optional &# 40 ; string &# 41 ;&# 10 ; ttl &# 61 ; optional &# 40 ; object &# 40 ;&# 123 ;&# 10 ; seconds &# 61 ; number &# 10 ; nanos &# 61 ; optional &# 40 ; number &# 41 ;&# 10 ; &# 125 ;&# 41 ;&# 41 ;&# 10 ; &# 125 ;&# 41 ;&# 41 ;&# 10 ; &# 125 ;&# 41 ;&# 41 ;&# 10 ; enable_subsetting &# 61 ; optional &# 40 ; bool &# 41 ;&# 10 ; failover_config &# 61 ; optional &# 40 ; object &# 40 ;&# 123 ;&# 10 ; disable_conn_drain &# 61 ; optional &# 40 ; bool &# 41 ;&# 10 ; drop_traffic_if_unhealthy &# 61 ; optional &# 40 ; bool &# 41 ;&# 10 ; ratio &# 61 ; optional &# 40 ; number &# 41 ;&# 10 ; &# 125 ;&# 41 ;&# 41 ;&# 10 ; iap_config &# 61 ; optional &# 40 ; object &# 40 ;&# 123 ;&# 10 ; oauth2_client_id &# 61 ; string &# 10 ; oauth2_client_secret &# 61 ; string &# 10 ; oauth2_client_secret_sha256 &# 61 ; optional &# 40 ; string &# 41 ;&# 10 ; &# 125 ;&# 41 ;&# 41 ;&# 10 ; outlier_detection &# 61 ; optional &# 40 ; object &# 40 ;&# 123 ;&# 10 ; consecutive_errors &# 61 ; optional &# 40 ; number &# 41 ;&# 10 ; consecutive_gateway_failure &# 61 ; optional &# 40 ; number &# 41 ;&# 10 ; enforcing_consecutive_errors &# 61 ; optional &# 40 ; number &# 41 ;&# 10 ; enforcing_consecutive_ga
2022-11-14 05:39:00 -08:00
| [description ](variables.tf#L23 ) | Optional description used for resources. | < code > string</ code > | | < code > " Terraform managed." </ code > |
2022-11-18 00:48:41 -08:00
| [global_access ](variables.tf#L30 ) | Allow client access from all regions. | < code > bool</ code > | | < code > null</ code > |
2023-06-30 10:34:09 -07:00
| [group_configs ](variables.tf#L36 ) | Optional unmanaged groups to create. Can be referenced in backends via key or outputs. | < code title = "map(object({ zone = string instances = optional(list(string)) named_ports = optional(map(number), {}) project_id = optional(string) }))" > map( object({…})) </ code > | | < code > {} </ code > |
2022-11-18 00:48:41 -08:00
| [health_check_configs ](variables-health-check.tf#L19 ) | Optional auto-created health check configurations, use the output self-link to set it in the auto healing policy. Refer to examples for usage. | < code title = "map(object({ check_interval_sec = optional(number) description = optional(string, "Terraform managed.") enable_logging = optional(bool, false) healthy_threshold = optional(number) project_id = optional(string) timeout_sec = optional(number) unhealthy_threshold = optional(number) grpc = optional(object({ port = optional(number) port_name = optional(string) port_specification = optional(string) # USE_FIXED_PORT USE_NAMED_PORT USE_SERVING_PORT service_name = optional(string) })) http = optional(object({ host = optional(string) port = optional(number) port_name = optional(string) port_specification = optional(string) # USE_FIXED_PORT USE_NAMED_PORT USE_SERVING_PORT proxy_header = optional(string) request_path = optional(string) response = optional(string) })) http2 = optional(object({ host = optional(string) port = optional(number) port_name = optional(string) port_specification = optional(string) # USE_FIXED_PORT USE_NAMED_PORT USE_SERVING_PORT proxy_header = optional(string) request_path = optional(string) response = optional(string) })) https = optional(object({ host = optional(string) port = optional(number) port_name = optional(string) port_specification = optional(string) # USE_FIXED_PORT USE_NAMED_PORT USE_SERVING_PORT proxy_header = optional(string) request_path = optional(string) response = optional(string) })) tcp = optional(object({ port = optional(number) port_name = optional(string) port_specification = optional(string) # USE_FIXED_PORT USE_NAMED_PORT USE_SERVING_PORT proxy_header = optional(string) request = optional(string) response = optional(string) })) ssl = optional(object({ port = optional(number) port_name = optional(string) port_specification = optional(string) # USE_FIXED_PORT USE_NAMED_PORT USE_SERVING_PORT proxy_header = optional(string) request = optional(string) response = optional(string) })) }))" > map( object({…})) </ code > | | < code title = "{ default = { http = { port_specification = "USE_SERVING_PORT" } } }" > {…} </ code > |
| [labels ](variables.tf#L48 ) | Labels set on resources. | < code > map( string) </ code > | | < code > {} </ code > |
2023-06-07 09:57:54 -07:00
| [neg_configs ](variables.tf#L59 ) | Optional network endpoint groups to create. Can be referenced in backends via key or outputs. | < code title = "map(object({ project_id = optional(string) cloudrun = optional(object({ region = string target_service = optional(object({ name = string tag = optional(string) })) target_urlmask = optional(string) })) gce = optional(object({ zone = string network = optional(string) subnetwork = optional(string) endpoints = optional(map(object({ instance = string ip_address = string port = number }))) })) hybrid = optional(object({ zone = string network = optional(string) endpoints = optional(map(object({ ip_address = string port = number }))) })) psc = optional(object({ region = string target_service = string network = optional(string) subnetwork = optional(string) })) }))" > map( object({…})) </ code > | | < code > {} </ code > |
| [network_tier_premium ](variables.tf#L125 ) | Use premium network tier. Defaults to true. | < code > bool</ code > | | < code > true</ code > |
| [ports ](variables.tf#L132 ) | Optional ports for HTTP load balancer, valid ports are 80 and 8080. | < code > list( string) </ code > | | < code > null</ code > |
| [protocol ](variables.tf#L143 ) | Protocol supported by this load balancer. | < code > string</ code > | | < code > " HTTP" </ code > |
| [service_directory_registration ](variables.tf#L161 ) | Service directory namespace and service used to register this load balancer. | < code title = "object({ namespace = string service = string })" > object({…}) </ code > | | < code > null</ code > |
| [ssl_certificates ](variables.tf#L170 ) | SSL target proxy certificates (only if protocol is HTTPS). | < code title = "object({ certificate_ids = optional(list(string), []) create_configs = optional(map(object({ certificate = string private_key = string })), {}) })" > object({…}) </ code > | | < code > {} </ code > |
2022-11-14 05:39:00 -08:00
| [urlmap_config ](variables-urlmap.tf#L19 ) | The URL map configuration. | < code title = "object({ default_service &# 61 ; optional &# 40 ; string &# 41 ;&# 10 ; default_url_redirect &# 61 ; optional &# 40 ; object &# 40 ;&# 123 ;&# 10 ; host &# 61 ; optional &# 40 ; string &# 41 ;&# 10 ; https &# 61 ; optional &# 40 ; bool &# 41 ;&# 10 ; path &# 61 ; optional &# 40 ; string &# 41 ;&# 10 ; prefix &# 61 ; optional &# 40 ; string &# 41 ;&# 10 ; response_code &# 61 ; optional &# 40 ; string &# 41 ;&# 10 ; strip_query &# 61 ; optional &# 40 ; bool &# 41 ;&# 10 ; &# 125 ;&# 41 ;&# 41 ;&# 10 ; host_rules &# 61 ; optional &# 40 ; list &# 40 ; object &# 40 ;&# 123 ;&# 10 ; hosts &# 61 ; list &# 40 ; string &# 41 ;&# 10 ; path_matcher &# 61 ; string &# 10 ; description &# 61 ; optional &# 40 ; string &# 41 ;&# 10 ; &# 125 ;&# 41 ;&# 41 ;&# 41 ;&# 10 ; path_matchers &# 61 ; optional &# 40 ; map &# 40 ; object &# 40 ;&# 123 ;&# 10 ; description &# 61 ; optional &# 40 ; string &# 41 ;&# 10 ; default_service &# 61 ; optional &# 40 ; string &# 41 ;&# 10 ; default_url_redirect &# 61 ; optional &# 40 ; object &# 40 ;&# 123 ;&# 10 ; host &# 61 ; optional &# 40 ; string &# 41 ;&# 10 ; https &# 61 ; optional &# 40 ; bool &# 41 ;&# 10 ; path &# 61 ; optional &# 40 ; string &# 41 ;&# 10 ; prefix &# 61 ; optional &# 40 ; string &# 41 ;&# 10 ; response_code &# 61 ; optional &# 40 ; string &# 41 ;&# 10 ; strip_query &# 61 ; optional &# 40 ; bool &# 41 ;&# 10 ; &# 125 ;&# 41 ;&# 41 ;&# 10 ; path_rules &# 61 ; optional &# 40 ; list &# 40 ; object &# 40 ;&# 123 ;&# 10 ; paths &# 61 ; list &# 40 ; string &# 41 ;&# 10 ; service &# 61 ; optional &# 40 ; string &# 41 ;&# 10 ; route_action &# 61 ; optional &# 40 ; object &# 40 ;&# 123 ;&# 10 ; request_mirror_backend &# 61 ; optional &# 40 ; string &# 41 ;&# 10 ; cors_policy &# 61 ; optional &# 40 ; object &# 40 ;&# 123 ;&# 10 ; allow_credentials &# 61 ; optional &# 40 ; bool &# 41 ;&# 10 ; allow_headers &# 61 ; optional &# 40 ; string &# 41 ;&# 10 ; allow_methods &# 61 ; optional &# 40 ; string &# 41 ;&# 10 ; allow_origin_regexes &# 61 ; list &# 40 ; string &# 41 ;&# 10 ; allow_origins &# 61 ; list &# 40 ; string &# 41 ;&# 10 ; disabled &# 61 ; optional &# 40 ; bool &# 41 ;&# 10 ; expose_headers &# 61 ; optional &# 40 ; string &# 41 ;&# 10 ; max_age &# 61 ; optional &# 40 ; string &# 41 ;&# 10 ; &# 125 ;&# 41 ;&# 41 ;&# 10 ; fault_injection_policy &# 61 ; optional &# 40 ; object &# 40 ;&# 123 ;&# 10 ; abort &# 61 ; optional &# 40 ; object &# 40 ;&# 123 ;&# 10 ; percentage &# 61 ; number &# 10 ; status &# 61 ; number &# 10 ; &# 125 ;&# 41 ;&# 41 ;&# 10 ; delay &# 61 ; optional &# 40 ; object &# 40 ;&# 123 ;&# 10 ; fixed &# 61 ; object &# 40 ;&# 123 ;&# 10 ; seconds &# 61 ; number &# 10 ; nanos &# 61 ; number &# 10 ; &# 125 ;&# 41 ;&# 10 ; percentage &# 61 ; number &# 10 ; &# 125 ;&# 41 ;&# 41 ;&# 10 ; &# 125 ;&# 41 ;&# 41 ;&# 10 ; retry_policy &# 61 ; optional &# 40 ; object &# 40 ;&# 123 ;&# 10 ; num_retries &# 61 ; number &# 10 ; retry_conditions &# 61 ; optional &# 40 ; list &# 40 ; string &# 41 ;&# 41 ;&# 10 ; per_try_timeout &# 61 ; optional &# 40 ; object &# 40 ;&# 123 ;&# 10 ; seconds &# 61 ; number &# 10 ; nanos &# 61 ; optional &# 40 ; number &# 41 ;&# 10 ; &# 125 ;&# 41 ;&# 41 ;&# 10 ; &# 125 ;&# 41 ;&# 41 ;&# 10 ; timeout &# 61 ; optional &# 40 ; object &# 40 ;&# 123 ;&# 10 ; seconds &# 61 ; number &# 10 ; nanos &# 61 ; optional &# 40 ; number &# 41 ;&# 10 ; &# 125 ;&# 41 ;&# 41 ;&# 10 ; url_rewrite &# 61 ; optional &# 40 ; object &# 40 ;&# 123 ;&# 10 ; host &# 61 ; optional &# 40 ; string &# 41 ;&# 10 ; path_prefix &# 61 ; optional &# 40 ; string &# 41 ;&# 10 ; &# 125 ;&# 41 ;&# 41 ;&# 10 ; weighted_backend_services &# 61 ; optional &# 40 ; map &# 40 ; object &# 40 ;&# 123 ;&# 10 ; weight &# 61 ; number &# 10 ; header_action &# 61 ; optional &# 40 ; object &# 40 ;&# 123 ;&# 10 ; request_add &# 61 ; optional &# 40 ; map &# 40 ; object &# 40 ;&# 123 ;&# 10 ; value &# 61 ; string &# 10 ; replace &# 61 ; optional &# 40 ; bool , true &# 41 ;&# 10 ; &# 125 ;&# 41 ;&# 41 ;&# 41 ;&# 10 ; request_remove &# 61 ; optional &# 40 ; list &# 40 ; string &# 41 ;&# 41 ;&# 10 ; response_add &#
2022-04-04 23:58:55 -07:00
## Outputs
| name | description | sensitive |
|---|---|:---:|
2022-11-14 05:39:00 -08:00
| [address ](outputs.tf#L17 ) | Forwarding rule address. | |
| [backend_service_ids ](outputs.tf#L22 ) | Backend service resources. | |
2023-03-17 03:40:11 -07:00
| [backend_service_names ](outputs.tf#L29 ) | Backend service resource names. | |
| [forwarding_rule ](outputs.tf#L36 ) | Forwarding rule resource. | |
| [group_ids ](outputs.tf#L41 ) | Autogenerated instance group ids. | |
| [health_check_ids ](outputs.tf#L48 ) | Autogenerated health check ids. | |
2023-06-02 07:07:22 -07:00
| [id ](outputs.tf#L55 ) | Fully qualified forwarding rule id. | |
| [neg_ids ](outputs.tf#L60 ) | Autogenerated network endpoint group ids. | |
2022-04-04 23:58:55 -07:00
<!-- END TFDOC -->