-
Notifications
You must be signed in to change notification settings - Fork 55
Description
Feature Request
Summary
Add support for specifying the VM boot mode (Secure or Legacy) in the cloudstack_instance resource, alongside the existing uefi option.
Current Behavior
At the moment, Terraform users can enable UEFI booting with:
uefi = trueHowever, there is no way to control the boot mode, although the CloudStack API supports this via the bootmode parameter in deployVirtualMachine.
Proposed Enhancement
Introduce a new optional argument boot_mode to the cloudstack_instance resource.
resource "cloudstack_instance" "example" {
name = "vm-secureboot"
service_offering = "Small Instance"
template = "ubuntu-uefi"
zone = "zone1"
network_id = "net-123"
uefi = true
boot_mode = "Secure" # or "Legacy"
}Behavior
- If uefi = false, boot_mode should be ignored or validated as unsupported.
- If uefi = true and boot_mode is not provided, default to "Legacy".
- Accepted values: "Secure", "Legacy" (case-insensitive).
- The value should map directly to the CloudStack API field bootmode.
Relationale
UEFI + Secure Boot are increasingly required in enterprise and compliance environments.
CloudStack supports these features natively since v4.14+( according to Cloudstack API Documentation), but Terraform users cannot currently configure Secure Boot declaratively.
Adding boot_mode makes the Terraform provider feature-complete for UEFI-capable VMs.
References
- Cloudstack API Documentation; deployVirtualMachine (parameters: boottype, bootmode) https://cloudstack.apache.org/api/apidocs-4.21/apis/deployVirtualMachine.html
- CloudStack Admin Guide – UEFI and Secure Boot https://docs.cloudstack.apache.org/en/latest/adminguide/virtual_machines.html#uefi-and-secure-boot
Implementation Hints
func resourceCloudStackInstance() *schema.Resource :
"boot_mode": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.StringInSlice([]string{"Secure", "Legacy"}, true),
},Map this field to the CloudStack API parameter bootmode.
There is already a conditional for the uefi value in func resourceCloudStackInstanceCreate(d *schema.ResourceData, meta interface{}) error.
if d.Get("uefi").(bool) {
p.SetBoottype("UEFI")
p.SetBootmode("Legacy")
}But bootmode is statically set to "Legacy"
Acceptance Criteria
- boot_mode can be set on cloudstack_instance.
- The parameter is passed correctly to deployVirtualMachine.
- The VM’s actual boot mode is reflected in Terraform state.
- Documentation and examples are updated.