Skip to content

Commit

Permalink
Allow setting DNS records in seperate GCP project
Browse files Browse the repository at this point in the history
add var gcp_dns_zones_project_id to service level
for seller and buyer modules
  • Loading branch information
davidae committed Nov 15, 2024
1 parent 26d7a1d commit 69a65d7
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 3 deletions.
1 change: 1 addition & 0 deletions production/deploy/gcp/terraform/modules/buyer/service.tf
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ module "load_balancing" {
collector_service_name = "collector"
collector_service_port = var.collector_service_port
region_config = var.region_config
gcp_dns_zones_project_id = var.gcp_dns_zones_project_id
}

resource "google_secret_manager_secret" "runtime_flag_secrets" {
Expand Down
6 changes: 6 additions & 0 deletions production/deploy/gcp/terraform/modules/buyer/service_vars.tf
Original file line number Diff line number Diff line change
Expand Up @@ -140,3 +140,9 @@ variable "enable_tee_container_log_redirect" {
type = bool
default = true
}

variable "gcp_dns_zones_project_id" {
description = "The name of the Google Cloud project where DNS zones are managed."
type = string
default = null
}
1 change: 1 addition & 0 deletions production/deploy/gcp/terraform/modules/seller/service.tf
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ module "load_balancing" {
collector_service_name = "collector"
collector_service_port = var.collector_service_port
region_config = var.region_config
gcp_dns_zones_project_id = var.gcp_dns_zones_project_id
}

resource "google_secret_manager_secret" "runtime_flag_secrets" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,3 +145,9 @@ variable "enable_tee_container_log_redirect" {
type = bool
default = true
}

variable "gcp_dns_zones_project_id" {
description = "The name of the Google Cloud project where DNS zones are managed."
type = string
default = null
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ resource "google_compute_global_forwarding_rule" "xlb_https" {
resource "google_dns_record_set" "default" {
name = "${var.operator}-${var.environment}.${var.frontend_domain_name}."
managed_zone = var.frontend_dns_zone
project = var.gcp_dns_zones_project_id
type = "A"
ttl = 10
rrdatas = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ variable "frontend_service_name" {
type = string
}


variable "google_compute_backend_service_ids" {
description = "a map with environment as key, the value is google_compute_backend_service_id"
type = map(string)
Expand All @@ -64,3 +63,9 @@ variable "traffic_weights" {
description = "a map with environment as key, the value is traffic_weight between 0~1000"
type = map(number)
}

variable "gcp_dns_zones_project_id" {
description = "The name of the Google Cloud project where DNS zones are managed."
type = string
default = null
}
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ resource "google_compute_global_forwarding_rule" "collectors" {
resource "google_dns_record_set" "collector" {
name = "${var.collector_service_name}-${var.operator}-${var.environment}.${var.frontend_domain_name}."
managed_zone = var.frontend_dns_zone
project = var.gcp_dns_zones_project_id
type = "A"
ttl = 10
routing_policy {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ variable "gcp_project_id" {
type = string
}

variable "gcp_dns_zones_project_id" {
description = "The name of the Google Cloud project where DNS zones are managed."
type = string
default = null
}

variable "frontend_domain_name" {
description = "Domain name for global external LB"
type = string
Expand Down Expand Up @@ -91,8 +97,6 @@ variable "collector_service_name" {
type = string
}



variable "collector_service_port" {
description = "The grpc port that receives traffic destined for the OpenTelemetry collector."
type = number
Expand Down

0 comments on commit 69a65d7

Please sign in to comment.