This example shows how to enable HTTPS Redirection on Google HTTP/S Loadbalancers.
[[ `basename $PWD` != multiple-certs ]] && cd examples/multiple-certs
- Install Terraform if it is not already installed (visit terraform.io for other distributions):
- Set the project, replace
YOUR_PROJECT
with your project ID:
PROJECT=YOUR_PROJECT
gcloud config set project ${PROJECT}
- Configure the environment for Terraform:
[[ $CLOUD_SHELL ]] || gcloud auth application-default login
export GOOGLE_PROJECT=$(gcloud config get-value project)
terraform init
terraform apply
- Open URL of load balancer in browser:
echo http://$(terraform output load-balancer-ip)
You should see the GCP logo and instance details.
- Remove all resources created by terraform:
terraform destroy
Name | Description | Type | Default | Required |
---|---|---|---|---|
network_name | string | "tf-lb-https-redirect-nat" |
no | |
project | string | n/a | yes | |
region | string | "us-east1" |
no | |
zone | string | "us-east1-b" |
no |
Name | Description |
---|---|
backend_services | |
load-balancer-ip | |
load-balancer-ipv6 |