FAQ | This is a LIVE service | Changelog

Skip to content
Snippets Groups Projects
Commit 0f1d1eff authored by Dr Rich Wareham's avatar Dr Rich Wareham
Browse files

allow ingress type to be specified

Provide a variable which allows ingress type to be specified. This
allows placing the service behind Cloud Load Balancer.

Provide variables which allow extra annotations to be added to the Cloud
Run service and the service template.
parent 0f6fdc14
No related branches found
No related tags found
1 merge request!13allow ingress type to be specified
Pipeline #56869 passed
......@@ -26,6 +26,20 @@ resource "google_cloud_run_service" "webapp" {
autogenerate_revision_name = true
metadata {
annotations = merge(
{
# Required to be able to set ingress type.
"run.googleapis.com/launch-stage" : "BETA",
# Specify the allowable ingress types.
"run.googleapis.com/ingress" : var.allowed_ingress,
},
var.service_annotations,
)
}
template {
metadata {
annotations = merge(
......@@ -49,7 +63,10 @@ resource "google_cloud_run_service" "webapp" {
# Cloud SQL instances to auto-magically make appear in the container as
# Unix sockets.
"run.googleapis.com/cloudsql-instances" = var.sql_instance_connection_name
} : {}
} : {},
# Additional template annotations passed as a variable.
var.template_annotations,
)
}
......
......@@ -122,3 +122,29 @@ variable "monitoring_path" {
default = "/"
description = "path component of url to be monitored"
}
variable "allowed_ingress" {
default = "all"
description = <<EOL
Specify the allowed ingress to the service. Should be one of:
"all", "internal" or "internal-and-cloud-load-balancing".
EOL
}
variable "service_annotations" {
type = map(string)
default = {}
description = <<EOL
Map containing additional annotations to be added to the Cloud Run service
itself.
EOL
}
variable "template_annotations" {
type = map(string)
default = {}
description = <<EOL
Map containing additional annotations to be added to the Cloud Run service
template.
EOL
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment