HeinzM opened a new issue, #250:
URL: https://github.com/apache/cloudstack-terraform-provider/issues/250

   ## 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:
   
   ```hcl
   uefi = true
   ```
   However, 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.
   ```hcl
   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](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](https://docs.cloudstack.apache.org/en/latest/adminguide/virtual_machines.html#uefi-and-secure-boot)
   
   ### Implementation Hints
   _func resourceCloudStackInstance() *schema.Resource_ :
   ```go
   "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_.
   
   ```go
   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.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to