diff --git a/blueprints/serverless/cloud-run-explore/main.tf b/blueprints/serverless/cloud-run-explore/main.tf index 9dade36d7..cdee0856c 100644 --- a/blueprints/serverless/cloud-run-explore/main.tf +++ b/blueprints/serverless/cloud-run-explore/main.tf @@ -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 + } + } + } + } +} diff --git a/blueprints/serverless/cloud-run-explore/variables.tf b/blueprints/serverless/cloud-run-explore/variables.tf index 3414aa08c..3bbd4c188 100644 --- a/blueprints/serverless/cloud-run-explore/variables.tf +++ b/blueprints/serverless/cloud-run-explore/variables.tf @@ -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 -} \ No newline at end of file +} + +variable "glb_create" { + description = "Create a Global Load Balancer in front of the Cloud Run service" + type = bool + default = false +}