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
+6 -2
View File
@@ -1,7 +1,10 @@
data "google_client_config" "default" {}
resource "google_compute_instance" "vm_hub" {
name = var.name
machine_type = var.machine_type
can_ip_forward = var.can_ip_forward
project = var.project_id != null ? var.project_id : data.google_client_config.default.project
description = var.description
boot_disk {
@@ -11,8 +14,9 @@ resource "google_compute_instance" "vm_hub" {
}
network_interface {
network = var.network_name
subnetwork = var.subnet_name
network = var.network_name
subnetwork = var.subnet_name
subnetwork_project = var.project_id != null ? var.project_id : data.google_client_config.default.project
}
metadata = {
+7
View File
@@ -3,6 +3,13 @@ variable "name" {
type = string
}
variable "project_id" {
description = "The GCP project ID. If not provided, the default project will be used."
type = string
nullable = true
default = null
}
variable "machine_type" {
description = "The machine type of the VM instance."
type = string