This page provides Terraform modules that you can use to deploy external Application Load Balancers. Depending on your preferred backend type, use one of the following examples to deploy a sample external Application Load Balancer.
If you are new to using Terraform for Google Cloud, see Get started with Terraform.
External Application Load Balancer with managed instance group (MIG) backends
You can use a Terraform module to bring up an external HTTP load balancer with Compute Engine backends.
This module creates multiple Terraform resources, including a VPC
network and subnetworks, Cloud Routers, all of the necessary load
balancer components, and backend instance groups. For
more information, download or clone the repository and run the terraform plan
command in the /terraform-google-lb-http/examples/multi-mig-http-lb
directory.
For more information about this example and to learn how to run it, see the README on GitHub.
External Application Load Balancer with MIG backend and custom headers
You can use Terraform resources to bring up an external Application Load Balancer with a Cloud CDN-enabled backend service and custom request and response headers.
For detailed information about the load balancer setup, see the primary setup guide.
External Application Load Balancer with a backend bucket and MIGs
You can use a Terraform module to bring up an external HTTPS load balancer with Compute Engine backends plus static assets being served from a Cloud Storage bucket.
This module creates multiple Terraform resources, including a VPC
network and subnetworks, a Cloud Storage bucket and object,
Cloud Routers, a self-signed SSL certificate, all of the necessary load
balancer components, and backend instance groups. For more information, download
or clone the repository and run the terraform plan
command in the
/terraform-google-lb-http/examples/multi-backend-multi-mig-bucket-https-lb
directory.
For more information about this example and to learn how to run it, see the README in GitHub.
External Application Load Balancer with a Cloud Run backend
You can use a Terraform module to bring up an external HTTPS load balancer with a Cloud Run backend.
This module creates multiple Terraform resources, including a Cloud Run
service, a self-signed SSL certificate, a URL map that sets up an HTTP-to-HTTPs
redirect, all of the necessary load balancer components, and backend
instance groups. For more information, download or clone the repository and run the
terraform plan
command in the /terraform-google-lb-http/examples/cloudrun
directory.
For more information about this example and to learn how to run it, see the README in GitHub.
External Application Load Balancer with an HTTP-to-HTTPS redirect
You can use a Terraform module to bring up an external HTTPS load balancer with HTTP-to-HTTPS redirection.
This module creates multiple Terraform resources, including a VPC
network and subnetwork, a self-signed SSL certificate, a Cloud Router,
all of the necessary load balancer components, and a backend instance group. For
more information, download or clone the repository and run the terraform plan
command in the /terraform-google-lb-http/examples/https-redirect
directory.
For more information about this example and to learn how to run it, see the README in GitHub.
External Application Load Balancer with Shared VPC
You can use a Terraform module to bring up an external Application Load Balancer in a Shared VPC setup.
This module creates multiple Terraform resources, including a VPC
network and subnetwork, a Cloud Router, all of the necessary load
balancer components, and a backend instance group. For more information,
download or clone the repository and run the terraform plan
command in the
/terraform-google-lb-http/examples/shared-vpc
directory.
For more information about this example and to learn how to run it, see the README in GitHub.