Add Global Load Balancer in front of Cloud Run
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
module "cloud_run" {
|
||||
source = "../../../modules/cloud-run"
|
||||
project_id = var.project_id
|
||||
name = "hello"
|
||||
name = var.run_svc_name
|
||||
region = var.region
|
||||
containers = [{
|
||||
image = var.image
|
||||
options = null
|
||||
@@ -13,3 +14,29 @@ module "cloud_run" {
|
||||
"roles/run.invoker" = ["allUsers"]
|
||||
}
|
||||
}
|
||||
|
||||
module "glb" {
|
||||
source = "../../../modules/net-glb"
|
||||
count = var.glb_create ? 1 : 0
|
||||
project_id = var.project_id
|
||||
name = "glb"
|
||||
backend_service_configs = {
|
||||
default = {
|
||||
backends = [
|
||||
{ backend = "neg-0" }
|
||||
]
|
||||
health_checks = []
|
||||
}
|
||||
}
|
||||
health_check_configs = {}
|
||||
neg_configs = {
|
||||
neg-0 = {
|
||||
cloudrun = {
|
||||
region = var.region
|
||||
target_service = {
|
||||
name = var.run_svc_name
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,25 @@ variable "project_id" {
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "region" {
|
||||
description = "Cloud region where resource will be deployed"
|
||||
type = string
|
||||
default = "europe-west1"
|
||||
}
|
||||
|
||||
variable "run_svc_name" {
|
||||
description = "Cloud Run service name"
|
||||
type = string
|
||||
default = "hello"
|
||||
}
|
||||
|
||||
variable "image" {
|
||||
description = "Container image to deploy"
|
||||
type = string
|
||||
}
|
||||
}
|
||||
|
||||
variable "glb_create" {
|
||||
description = "Create a Global Load Balancer in front of the Cloud Run service"
|
||||
type = bool
|
||||
default = false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user