Skip to main content

In-Place VM Scaling with Terraform

The NetActuate Terraform provider supports in-place VM plan changes. When you modify the plan attribute of a server resource, Terraform scales the VM without rebuilding it, preserving the IP address, hostname, and disk contents.

How It Works​

Changing only the plan attribute on a netactuate_server resource triggers the ScaleServer API instead of a destroy-and-recreate cycle. Terraform polls the scaling job until it completes, then waits for the VM to return to RUNNING status.

Key behaviors:

  • The IP address is preserved across all scaling operations
  • Hostname and disk contents remain unchanged
  • Scale up (for example, VR1x1x25 to VR2x2x25) typically completes in seconds and may not require a reboot
  • Scale down (for example, VR2x2x25 to VR1x1x25) requires a reboot to reduce allocated RAM, usually completing in around 13 seconds

Reboot Guardrails​

In-place upgrades that need no reboot happen automatically. Scaling operations that downsize a VM or otherwise require a reboot are rejected unless you opt in with allow_downsize_reboot:

resource "netactuate_server" "web" {
hostname = "web01.example.com"
plan = "VR2x2x25"
location = "SJC"
image = "Ubuntu 22.04"
ssh_key = var.ssh_key
package_billing_contract_id = var.contract_id
allow_downsize_reboot = true
}
  • When set to true, Terraform permits a downsize or another scaling change that requires a VM reboot.
  • When omitted or set to false, Terraform rejects scaling operations that require a reboot. Use this when your workload cannot tolerate an unexpected restart.

Example: Scaling a VM​

Start with a small plan in your terraform.tfvars:

plan = "VR1x1x25"

Reference the variable in your server resource:

variable "plan" {
type = string
}

variable "contract_id" {
type = string
}

variable "ssh_key" {
type = string
}

resource "netactuate_server" "web" {
hostname = "web01.example.com"
plan = var.plan
location = "SJC"
image = "Ubuntu 22.04"
ssh_key = var.ssh_key
package_billing_contract_id = var.contract_id
allow_downsize_reboot = true
}

To scale up, change the plan value:

plan = "VR2x2x25"

Run terraform apply. Terraform detects an in-place update and calls the ScaleServer API:

netactuate_server.web: Modifying... [id=12345]
netactuate_server.web: Still modifying... [5s elapsed]
netactuate_server.web: Modifications complete after 8s [id=12345]

Apply complete! Resources: 0 added, 1 changed, 0 destroyed.

The VM retains its IP address, hostname, and all data on disk.

What Triggers Scaling vs Rebuild​

Not every change to a server resource triggers an in-place scale. The provider uses these rules:

ChangeResult
plan onlyIn-place scale (no rebuild)
location, image, or hostnameFull rebuild (new VM)
plan combined with other changesFull rebuild (new VM)

If you need to change the plan and another attribute at the same time, Terraform will destroy and recreate the VM. To avoid data loss, change the plan first, apply, then change the other attribute in a separate apply.

Available Plans​

The following plans are representative. Use data.netactuate_plans to list all plans available at your location.

PlanvCPUsRAM (GB)Disk (GB)
VR1x1x251125
VR2x2x252225
VR4x4x504450
VR8x8x20088200

Portal and API Scaling​

For scaling VMs through the portal or the REST API directly, see VM Scaling.

Additional Resources​

Need Help?​

If you need assistance, visit our support page.