Skip to content

Commit e47cf7e

Browse files
Merge pull request #157 from damnsam/network-and-disk-updates
Network and disk updates - Add three new properties to data_disk (disk_sharing, attach, and path) These three new properties (along with the existing datastore_id, disk_mode and unit_number) are required to enable the ability to add shared disks created by a separate "vsphere_virtual_disk" resource. For example, a main.tf could contain:
2 parents 00b55db + 69cc089 commit e47cf7e

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

main.tf

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ data "vsphere_resource_pool" "pool" {
2828

2929
data "vsphere_network" "network" {
3030
count = length(var.network)
31-
name = keys(var.network)[count.index]
31+
name = var.network_delimiter != null ? split(var.network_delimiter,keys(var.network)[count.index])[1] : keys(var.network)[count.index]
3232
datacenter_id = data.vsphere_datacenter.dc.id
3333
}
3434

@@ -207,6 +207,9 @@ resource "vsphere_virtual_machine" "vm" {
207207
io_share_level = lookup(terraform_disks.value, "io_share_level", "normal")
208208
io_share_count = lookup(terraform_disks.value, "io_share_level", null) == "custom" ? lookup(terraform_disks.value, "io_share_count") : null
209209
disk_mode = lookup(terraform_disks.value, "disk_mode", null)
210+
disk_sharing = lookup(terraform_disks.value, "disk_sharing", null)
211+
attach = lookup(terraform_disks.value, "attach", null)
212+
path = lookup(terraform_disks.value, "path", null)
210213
}
211214
}
212215
clone {

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ variable "network" {
55
default = {}
66
}
77

8+
variable "network_delimiter" {
9+
description = "If network name needs a delimiter for sequencing, define an UNUSED character here, otherwise leave as null"
10+
type = string
11+
default = null
12+
}
13+
814
variable "network_type" {
915
description = "Define network type for each network interface."
1016
type = list(any)

0 commit comments

Comments
 (0)