> ## Documentation Index
> Fetch the complete documentation index at: https://docs.formae.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Deploy an HTTP(S) load balancer

> A GCP infrastructure pattern, deployed with formae.

A complete global external Application Load Balancer. One forma reserves a
global static IP, defines a health check and a backend service, and wires a URL
map, an HTTP target proxy, and a global forwarding rule so traffic entering on
the static IP is routed through to the backend service.

```mermaid theme={"languages":{"custom":["/languages/pkl.json"]}}
flowchart LR
  target["gcp-target"]:::tgt

  subgraph stack["gcp-loadbalancer-stack"]
    direction LR
    ip["Global IP address"]:::res
    hc["Health check"]:::res
    backend["Backend service"]:::res
    urlmap["URL map"]:::res
    proxy["Target HTTP proxy"]:::res
    fwd["Global forwarding rule"]:::res

    hc --> backend
    backend --> urlmap
    urlmap --> proxy
    proxy --> fwd
    ip --> fwd
  end

  target --> stack

  classDef tgt fill:#FF8201,stroke:#B25900,color:#ffffff
  classDef res fill:#FFF3E6,stroke:#FF8201,color:#02024B
  style stack fill:#ffffff,stroke:#02024B,stroke-width:2px,stroke-dasharray:6 4,color:#02024B
```

**Deploy.** Apply the example forma. formae orders the resources by their
dependencies automatically, so the health check comes up before the backend
service, the URL map before the proxy, and the forwarding rule last:

```bash theme={"languages":{"custom":["/languages/pkl.json"]}}
formae apply --mode reconcile \
  /opt/pel/formae/examples/formae-plugin-gcp/gcp-loadbalancer/gcp_loadbalancer.pkl
```

**Verify.** Once the command completes, the stack's resources are under
management:

```bash theme={"languages":{"custom":["/languages/pkl.json"]}}
formae inventory resources --query="type:GCP::Compute::GlobalForwardingRule"
```

**Tear down.** Remove everything the forma created:

```bash theme={"languages":{"custom":["/languages/pkl.json"]}}
formae destroy \
  /opt/pel/formae/examples/formae-plugin-gcp/gcp-loadbalancer/gcp_loadbalancer.pkl
```

The full forma is in the
[gcp-loadbalancer example](https://github.com/platform-engineering-labs/formae-plugin-gcp/tree/main/examples/gcp-loadbalancer).
