cloud-foundation-fabric/blueprints/serverless/cloud-run-explore/main.tf

62 lines
1.3 KiB
Terraform
Raw Normal View History

2023-01-26 02:50:52 -08:00
# Cloud Run service
module "cloud_run" {
source = "../../../modules/cloud-run"
project_id = var.project_id
name = var.run_svc_name
region = var.region
containers = [{
image = var.image
options = null
ports = null
resources = null
volume_mounts = null
}]
iam = {
"roles/run.invoker" = ["allUsers"]
}
}
2023-01-26 02:50:52 -08:00
# Reserved static IP for the Load Balancer
resource "google_compute_global_address" "default" {
count = var.glb_create ? 1 : 0
project = var.project_id
name = "glb-ip"
}
# Global L7 HTTPS Load Balancer in front of Cloud Run
module "glb" {
source = "../../../modules/net-glb"
count = var.glb_create ? 1 : 0
project_id = var.project_id
name = "glb"
2023-01-26 02:50:52 -08:00
address = google_compute_global_address.default[0].id
backend_service_configs = {
default = {
backends = [
{ backend = "neg-0" }
]
health_checks = []
2023-01-26 05:30:54 -08:00
port_name = "http"
}
}
health_check_configs = {}
neg_configs = {
neg-0 = {
cloudrun = {
region = var.region
target_service = {
name = var.run_svc_name
}
}
}
}
2023-01-26 02:50:52 -08:00
protocol = "HTTPS"
ssl_certificates = {
managed_configs = {
default = {
2023-01-26 07:42:49 -08:00
domains = [var.custom_domain]
2023-01-26 02:50:52 -08:00
}
}
}
}