Skip to content

Commit afd258f

Browse files
committed
add fqdnvmname functionality
1 parent 76a01f9 commit afd258f

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ locals {
8080
resource "vsphere_virtual_machine" "vm" {
8181
count = var.instances
8282
depends_on = [var.vm_depends_on]
83-
name = var.staticvmname != null ? var.staticvmname : format("${var.vmname}${var.vmnameformat}", count.index + 1)
83+
name = "${var.staticvmname != null ? var.staticvmname : format("${var.vmname}${var.vmnameformat}", count.index + 1)}${var.fqdnvmname == true ? ".${var.domain}" : ""}"
8484

8585
resource_pool_id = var.vmrp != "" ? data.vsphere_resource_pool.pool[0].id : var.vmrpid
8686
folder = var.vmfolder

variables.tf

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,12 @@ variable "staticvmname" {
130130
default = null
131131
}
132132

133+
variable "fqdnvmname" {
134+
description = "If true, the vm will be created using domain variable appended"
135+
type = bool
136+
default = false
137+
}
138+
133139
variable "vmtemp" {
134140
description = "Name of the template available in the vSphere."
135141
}
@@ -307,7 +313,7 @@ variable "hw_clock_utc" {
307313
}
308314

309315
variable "domain" {
310-
description = "default VM domain for linux guest customization."
316+
description = "default VM domain for linux guest customization and fqdn name (if fqdnvmname is true)."
311317
default = "Development.com"
312318
}
313319

0 commit comments

Comments
 (0)