Added conditional project designation feature for relevant modules.

This commit is contained in:
2025-03-31 21:17:33 +02:00
parent fadc7573cb
commit e7222382f1
13 changed files with 89 additions and 20 deletions
+4 -2
View File
@@ -1,7 +1,9 @@
data "google_client_config" "default" {}
resource "google_dns_managed_zone" "zone" {
dns_name = var.dns_name
name = var.zone_name != null ? var.zone_name : "${replace(replace(var.dns_name, "/\\.$/", ""), ".", "-")}-zone"
project = var.project_id
project = var.project_id != null ? var.project_id : data.google_client_config.default.project
visibility = var.network_id != null ? "private" : "public"
@@ -38,7 +40,7 @@ resource "google_dns_managed_zone" "zone" {
resource "google_dns_record_set" "records" {
count = length(var.resource_records)
project = var.project_id
project = var.project_id != null ? var.project_id : data.google_client_config.default.project
managed_zone = google_dns_managed_zone.zone.name
name = var.resource_records[count.index].name
+3 -1
View File
@@ -1,6 +1,8 @@
variable "project_id" {
description = "The project ID where the managed zone will be created."
description = "The GCP project ID. If not provided, the default project will be used."
type = string
nullable = true
default = null
}
variable "dns_name" {