Documentation Index
Fetch the complete documentation index at: https://docs.phala.com/llms.txt
Use this file to discover all available pages before exploring further.
phala_cvm_power lets you start or stop an existing CVM without recreating or modifying the parent phala_app resource. This is useful for cost management, maintenance windows, or controlled rollouts where you want to decouple power state from deployment lifecycle.
Example Usage
phala_cvm_power converges it to stopped. Changing state back to "running" on the next apply starts it again.
Required Attributes
| Attribute | Type | Description |
|---|---|---|
cvm_id | String | The target CVM ID. Typically sourced from phala_app.<name>.primary_cvm_id. |
state | String | Desired power state: "running" or "stopped". |
Optional Attributes
| Attribute | Type | Description |
|---|---|---|
wait_for_state | Boolean | Wait until the CVM reaches the target state before Terraform returns. |
wait_timeout_seconds | Number | Timeout in seconds for the state wait. |
Setting
wait_for_state = true is recommended. Without it, Terraform marks the resource as converged immediately after issuing the start/stop API call, even if the CVM has not finished transitioning.Read-Only (Computed) Attributes
| Attribute | Type | Description |
|---|---|---|
id | String | Resource ID (same as cvm_id). |
status | String | Current CVM status as reported by the API. |
Behavior
Drift Detection
On everyterraform plan, the provider reads the current CVM status from the API. If the actual power state does not match the declared state, Terraform shows a diff and the next apply issues the appropriate start or stop call.
Delete Semantics
Destroying aphala_cvm_power resource only removes it from Terraform state. It does not stop or delete the CVM. The CVM continues running (or stays stopped) in whatever state it was last set to. To actually delete the CVM, destroy the parent phala_app resource.
API Backing
The resource uses these Phala Cloud API endpoints:POST /cvms/{id}/start— to transition torunningPOST /cvms/{id}/stop— to transition tostoppedGET /cvms/{id}— for read and drift detection
Related
- phala_app Resource — the parent lifecycle resource
- Examples — power management patterns

