This module allows managing a GCE Internal Load Balancer and integrates the forwarding rule, regional backend, and optional health check resources. It's designed to be a simple match for the [`compute-vm`](../compute-vm) module, which can be used to manage instance templates and instance groups.
TODO(ludoo): check if this is still the case after splitting out MIG from compute-vm
There are some corner cases (eg when switching the instance template from internal service account to an externally managed one) where Terraform raises a cycle error on apply. In these situations, run successive applies targeting resources used in the template first then the template itself, and the cycle should be fixed.
One other issue is a `Provider produced inconsistent final plan` error which is sometimes raised when switching template version. This seems to be related to this [open provider issue](https://github.com/terraform-providers/terraform-provider-google/issues/3937), but it's relatively harmless since the resource is updated, and subsequent applies raise no errors.
## Example
This example spins up a simple HTTP server and combines four modules:
- [`nginx`](../cloud-config-container/nginx) from the `cloud-config-container` collection, to manage instance configuration
- [`compute-vm`](../compute-vm) to manage the instance template and unmanaged instance group
- this module to create an Internal Load Balancer in front of the managed instance group
Note that the example uses the GCE default service account. You might want to create an ad-hoc service account by combining the [`iam-service-accounts`](../iam-service-accounts) module, or by having the GCE VM module create one for you. In both cases, remember to set at least logging write permissions for the service account, or the container on the instances won't be able to start.
| *global_access* | Global access, defaults to false if not set. | <codetitle="">bool</code> | | <codetitle="">null</code> |
| *health_check* | Name of existing health check to use, disables auto-created health check. | <codetitle="">string</code> | | <codetitle="">null</code> |
| *labels* | Labels set on resources. | <codetitle="map(string)">map(string)</code> | | <codetitle="">{}</code> |
| *log_sample_rate* | Set a value between 0 and 1 to enable logging for resources, and set the sampling rate for backend logging. | <codetitle="">number</code> | | <codetitle="">null</code> |
| *ports* | Comma-separated ports, leave null to use all ports. | <codetitle="list(string)">list(string)</code> | | <codetitle="">null</code> |
| *protocol* | IP protocol used, defaults to TCP. | <codetitle="">string</code> | | <codetitle="">TCP</code> |
| *service_label* | Optional prefix of the fully qualified forwarding rule name. | <codetitle="">string</code> | | <codetitle="">null</code> |