Skip to content

Commit

Permalink
Add enable_custom_domain configuration option
Browse files Browse the repository at this point in the history
  • Loading branch information
royal authored Oct 17, 2023
1 parent aafd831 commit a92f129
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions gcp/cloud-run-v2/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ resource "google_cloud_run_service_iam_binding" "noauth" {

# Network Endpoint Group (NEG) for Cloud Run service
resource "google_compute_region_network_endpoint_group" "cloudrun_neg" {
count = var.enable_custom_domain ? 1 : 0
name = "${var.name}-neg"
network_endpoint_type = "SERVERLESS" # Serverless NEG
region = var.project_region # Region
Expand Down Expand Up @@ -170,6 +171,7 @@ resource "google_compute_security_policy" "cloud_armor_policy" {
# Load Balancer module using serverless NEGs
# View all options on https://github.com/terraform-google-modules/terraform-google-lb-http
module "lb-http" {
count = var.enable_custom_domain ? 1 : 0
source = "GoogleCloudPlatform/lb-http/google//modules/serverless_negs"
project = var.project_id
name = "${var.name}-lb"
Expand Down
6 changes: 6 additions & 0 deletions gcp/cloud-run-v2/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -248,3 +248,9 @@ variable "dependencies" {
type = list(string)
default = []
}

variable "enable_custom_domain" {
description = "Create necessary resources to bind a custom domain to the resource"
type = bool
default = true
}

0 comments on commit a92f129

Please sign in to comment.