diff --git a/main.tf b/main.tf index 741ac8c9d87b0c63b0241174c988a07932651880..a70a41d0acc043d8eeb325c8bf9bfb3a32d7a4b8 100644 --- a/main.tf +++ b/main.tf @@ -37,15 +37,16 @@ resource "google_cloud_run_service" "webapp" { "run.googleapis.com/ingress-status" : "placeholder", }, - var.allowed_ingress != "" ? ( - { - # Required to be able to set ingress type. - "run.googleapis.com/launch-stage" : "BETA", + # Add the beta launch stage if required. + var.allowed_ingress != "all" ? { + # 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, - } - ) : {}, + # Specify the allowable ingress types. + { + "run.googleapis.com/ingress" : var.allowed_ingress, + }, var.service_annotations, ) diff --git a/variables.tf b/variables.tf index 777db31ebd139999272d55fcce0a224b02cec43e..77d840122b7414c8facc3025150f875e3f958246 100644 --- a/variables.tf +++ b/variables.tf @@ -124,13 +124,13 @@ variable "monitoring_path" { } variable "allowed_ingress" { - default = "" + default = "all" description = <<EOL Specify the allowed ingress to the service. Should be one of: - "", "all", "internal" or "internal-and-cloud-load-balancing". + "all", "internal" or "internal-and-cloud-load-balancing". - Setting this to a non-empty value implies that the service will be moved to - the "beta" launch stage. See + Setting this to a value other than "all" implies that the service will be + moved to the "beta" launch stage. See https://cloud.google.com/run/docs/troubleshooting#launch-stage-validation. EOL }