Skip to content

Commit e07d54c

Browse files
Merge pull request #201 from Cloud-Temple/199-handle-extra_config-for-cloud-init
Added new guestinfo extra_config keys
2 parents e75aa3f + 9502d95 commit e07d54c

2 files changed

Lines changed: 19 additions & 0 deletions

File tree

docs/resources/compute_virtual_machine.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,7 @@ Supported configurations include:
352352
- Performance optimization: 'stealclock.enable'
353353
- Disk configuration: 'disk.enableUUID'
354354
- PCI Passthrough: 'pciPassthru.use64BitMMIO', 'pciPassthru.64bitMMioSizeGB'
355+
- Guest info for cloud-init: 'guestinfo.userdata', 'guestinfo.userdata.encoding', 'guestinfo.metadata', 'guestinfo.metadata.encoding'
355356

356357
Note: Changes to extra_config may require a virtual machine restart to take effect.
357358
- `guest_operating_system_moref` (String) The operating system to launch the virtual machine with.

internal/provider/resource_compute_virtual_machine.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -596,11 +596,25 @@ Supported configurations include:
596596
- Performance optimization: 'stealclock.enable'
597597
- Disk configuration: 'disk.enableUUID'
598598
- PCI Passthrough: 'pciPassthru.use64BitMMIO', 'pciPassthru.64bitMMioSizeGB'
599+
- Guest info for cloud-init: 'guestinfo.userdata', 'guestinfo.userdata.encoding', 'guestinfo.metadata', 'guestinfo.metadata.encoding'
599600
600601
Note: Changes to extra_config may require a virtual machine restart to take effect.`,
601602
Elem: &schema.Schema{
602603
Type: schema.TypeString,
603604
},
605+
ValidateDiagFunc: validation.MapKeyMatch(regexp.MustCompile(strings.Join([]string{
606+
"^guestinfo\\.ignition\\.config\\.data$",
607+
"^guestinfo\\.ignition\\.config\\.data\\.encoding$",
608+
"^guestinfo\\.afterburn\\.initrd\\.network-kargs$",
609+
"^stealclock\\.enable$",
610+
"^disk\\.enableUUID$",
611+
"^pciPassthru\\.use64BitMMIO$",
612+
"^pciPassthru\\.64bitMMioSizeGB$",
613+
"^guestinfo\\.userdata$",
614+
"^guestinfo\\.userdata\\.encoding$",
615+
"^guestinfo\\.metadata$",
616+
"^guestinfo\\.metadata\\.encoding$",
617+
}, "|")), "The following key is not allowed for extra_config"),
604618
},
605619

606620
// Out
@@ -1535,6 +1549,10 @@ func suppressUnmanagedExtraConfigDiff(k, old, new string, d *schema.ResourceData
15351549
"disk.enableUUID": true,
15361550
"pciPassthru.use64BitMMIO": true,
15371551
"pciPassthru.64bitMMioSizeGB": true,
1552+
"guestinfo.userdata": true,
1553+
"guestinfo.userdata.encoding": true,
1554+
"guestinfo.metadata": true,
1555+
"guestinfo.metadata.encoding": true,
15381556
}
15391557

15401558
// Extract the key name from the path (e.g., "extra_config.svga.present" -> "svga.present")

0 commit comments

Comments
 (0)