Skip to content

Conversation

@Pearl1594
Copy link
Contributor

Doesn't allow setting boot mode when uefi is false

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # cloudstack_instance.initial_vm will be created
  + resource "cloudstack_instance" "initial_vm" {
      + boot_mode              = "Secure"
      + disk_offering          = (known after apply)
      + display_name           = (known after apply)
      + expunge                = true
      + group                  = (known after apply)
      + id                     = (known after apply)
      + ip_address             = (known after apply)
      + name                   = "initial-web-server"
      + network_id             = (known after apply)
      + override_disk_offering = (known after apply)
      + project                = (known after apply)
      + root_disk_size         = (known after apply)
      + service_offering       = "CKSMinimum"
      + start_vm               = true
      + tags                   = (known after apply)
      + template               = "ubuntu"
      + uefi                   = false
      + zone                   = "ref-trl-9688-k-Mol8-pearl-dsilva"
    }

  # cloudstack_network.vm_network will be created
  + resource "cloudstack_network" "vm_network" {
      + acl_id                = "none"
      + cidr                  = "10.0.10.0/24"
      + display_text          = "Isolated network for VMs"
      + endip                 = (known after apply)
      + gateway               = (known after apply)
      + id                    = (known after apply)
      + name                  = "vm-isolated-network"
      + network_domain        = (known after apply)
      + network_offering      = "DefaultIsolatedNetworkOfferingWithSourceNatService"
      + project               = (known after apply)
      + source_nat_ip_address = (known after apply)
      + source_nat_ip_id      = (known after apply)
      + startip               = (known after apply)
      + tags                  = (known after apply)
      + zone                  = "ref-trl-9688-k-Mol8-pearl-dsilva"
    }

Plan: 2 to add, 0 to change, 0 to destroy.
cloudstack_network.vm_network: Creating...
cloudstack_network.vm_network: Creation complete after 2s [id=09d5f2af-f39a-4ba0-98aa-863e0bd8e993]
cloudstack_instance.initial_vm: Creating...
╷
│ Error: boot_mode can only be specified when uefi is true, got boot_mode=Secure with uefi=false
│ 
│   with cloudstack_instance.initial_vm,
│   on main.tf line 32, in resource "cloudstack_instance" "initial_vm":
│   32: resource "cloudstack_instance" "initial_vm" {

On setting UEFI to true and boot_mode to secure it successfully deploys the VM

$ terraform state show cloudstack_instance.initial_vm
# cloudstack_instance.initial_vm:
resource "cloudstack_instance" "initial_vm" {
    boot_mode        = "secure"
    disk_offering    = null
    display_name     = "initial-web-server"
    expunge          = true
    group            = null
    id               = "8f78aa48-c06d-43ba-bf07-35c8947eb436"
    ip_address       = "10.0.10.8"
    name             = "initial-web-server"
    network_id       = "5c1cf4a7-2c33-47f9-ad88-8360fe63fc93"
    project          = null
    root_disk_size   = 4
    service_offering = "CKSMinimum"
    start_vm         = true
    tags             = {}
    template         = "ubuntu"
    uefi             = true
    zone             = "ref-trl-9688-k-Mol8-pearl-dsilva"
}

@Pearl1594
Copy link
Contributor Author

@HeinzM Would you be able to review this - It addresses the issue: #250

@HeinzM
Copy link

HeinzM commented Oct 20, 2025

@HeinzM Would you be able to review this - It addresses the issue: #250

Sure, I can do this.

Copy link

@HeinzM HeinzM left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

boot_mode integrates with existing uefi logic
Code formatted and consistent
Can't test backwards compatibility, but your tests seems to cover this point.
Suggestion: add a short description for boot_mode in schema + docs example.

@Pearl1594
Copy link
Contributor Author

Thanks @HeinzM - I've addressed your comments.

Copy link
Collaborator

@kiranchavala kiranchavala left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Tested manully with boot_mode and uefi parameter and the vm boots up fine

resource "cloudstack_instance" "initial_vm" {
    boot_mode        = "secure"
    display_name     = "kiran-test"
    expunge          = true
    name             = "kiran-test"
    network_id       = "f4c6e072-8f74-410d-836d-f096d3dd34d4"
    service_offering = "CKS"
    start_vm         = true
    template         = "ubuntu"
    uefi             = true
    zone             = "ref-trl-9722-k-Mol8-kiran-chavala"
}


erraform apply

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # cloudstack_instance.initial_vm will be created
  + resource "cloudstack_instance" "initial_vm" {
      + boot_mode              = "secure"
      + disk_offering          = (known after apply)
      + display_name           = "kiran-test"
      + expunge                = true
      + group                  = (known after apply)
      + id                     = (known after apply)
      + ip_address             = (known after apply)
      + name                   = "kiran-test"
      + network_id             = "f4c6e072-8f74-410d-836d-f096d3dd34d4"
      + override_disk_offering = (known after apply)
      + project                = (known after apply)
      + root_disk_size         = (known after apply)
      + service_offering       = "CKS"
      + start_vm               = true
      + tags                   = (known after apply)
      + template               = "ubuntu
      + uefi                   = true
      + zone                   = "ref-trl-9722-k-Mol8-kiran-chavala"
    }
    
    ```

Plan: 1 to add, 0 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

cloudstack_instance.initial_vm: Creating...
cloudstack_instance.initial_vm: Still creating... [00m10s elapsed]
cloudstack_instance.initial_vm: Creation complete after 14s [id=4aaea6e5-3c39-4ee0-a037-828606b6fdd7]

@kiranchavala kiranchavala reopened this Oct 21, 2025
@kiranchavala kiranchavala merged commit 47b2bbf into main Oct 21, 2025
165 of 183 checks passed
@kiranchavala kiranchavala added this to the v0.6.0 milestone Oct 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants