Skip to content

Commit 78c7ad6

Browse files
added multiple cloud-init and metadata support
1 parent 307d2c6 commit 78c7ad6

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

Diff for: modules/virtual-machine/main.tf

+2-7
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,7 @@ resource "vsphere_virtual_machine" "vm" {
3434
}
3535

3636
extra_config = {
37-
"guestinfo.userdata" = var.cloud_init_data
38-
"guestinfo.metadata" = var.metadata
39-
}
40-
41-
vapp {
42-
properties = {
43-
"guestinfo.hostname" = "local-foo.example.com",
37+
"guestinfo.userdata" = file(var.cloud_init_data[count.index])
38+
"guestinfo.metadata" = file(var.metadata[count.index])
4439
}
4540
}

Diff for: modules/virtual-machine/variables.tf

+4-4
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,13 @@ variable vm_memory {
5353
}
5454

5555
variable "cloud_init_data" {
56-
type = string
56+
type = list(string)
5757
description = "User-input for cloud init"
58-
default = ""
58+
default = [""]
5959
}
6060

6161
variable "metadata" {
62-
type = string
62+
type = list(string)
6363
description = "metadata for cloud init"
64-
default = ""
64+
default = [""]
6565
}

0 commit comments

Comments
 (0)