Skip to main content
The Phala Cloud provider includes seven read-only data sources. Use them to discover valid configuration values (sizes, regions, images, nodes) and to inspect account or attestation state. Data sources are refreshed on every terraform plan and terraform apply.

phala_account

Returns current account info including user profile, credits, and active workspace linkage.
data "phala_account" "current" {}

output "username" {
  value = data.phala_account.current.username
}

output "credit_balance" {
  value = data.phala_account.current.credit_balance
}

Attributes

AttributeTypeDescription
idStringStable account identifier.
usernameStringAccount username.
emailStringAccount email address.
email_verifiedBooleanWhether the email is verified.
avatarStringAvatar URL.
roleStringAccount role.
has_passwordBooleanWhether a password is set.
totp_enabledBooleanWhether TOTP 2FA is enabled.
has_backup_codesBooleanWhether backup codes exist.
credit_balanceStringCurrent credit balance.
credit_granted_balanceStringGranted credit balance.
credit_outstanding_amountStringOutstanding credit amount.
credit_is_post_paidBooleanWhether the account is post-paid.
workspace_idStringActive workspace ID.
workspace_nameStringActive workspace name.
workspace_slugStringActive workspace slug.
workspace_roleStringRole in the active workspace.
workspace_tierStringWorkspace tier (e.g. free, pro).

phala_workspace

Returns metadata about the active workspace for the current API key.
data "phala_workspace" "current" {}

output "workspace_name" {
  value = data.phala_workspace.current.name
}

output "workspace_tier" {
  value = data.phala_workspace.current.tier
}

Attributes

AttributeTypeDescription
idStringWorkspace ID (immutable).
nameStringWorkspace display name.
slugStringWorkspace slug.
roleStringCurrent user’s role in this workspace.
tierStringWorkspace tier.
avatarStringWorkspace avatar URL.

phala_sizes

Lists available CVM instance types. Use this to discover valid size slugs for phala_app.
data "phala_sizes" "all" {}

output "available_sizes" {
  value = data.phala_sizes.all.sizes[*].slug
}

Input Attributes

AttributeTypeDescription
familyStringOptional filter by instance family (e.g. cpu, gpu, tdx).

Output: sizes List

Each entry in sizes contains:
AttributeTypeDescription
slugStringInstance type slug (use this as the size value in phala_app).
nameStringDisplay name.
descriptionStringHuman-readable description.
familyStringInstance family.
vcpuNumberNumber of virtual CPUs.
memory_mbNumberMemory in megabytes.
default_disk_size_gbNumberDefault disk size in GB.
hourly_rateStringHourly cost.
requires_gpuBooleanWhether this size requires GPU nodes.

phala_regions

Lists available deployment regions.
data "phala_regions" "all" {}

output "available_regions" {
  value = data.phala_regions.all.regions[*].slug
}

Output: regions List

Each entry in regions contains:
AttributeTypeDescription
slugStringRegion slug (use this as the region value in phala_app).
nameStringDisplay name.
availableBooleanWhether the region currently accepts new deployments.

phala_images

Lists available OS images for CVMs. Always use the exact slug from this data source when setting the image attribute on phala_app.
data "phala_images" "west" {
  region = "US-WEST-1"
}

output "image_slugs" {
  value = data.phala_images.west.images[*].slug
}
Use the full image slug (e.g. dstack-dev-0.5.7-9b6a5239), not a shortened version like dstack-dev or dstack-dev-0.5.7. Shortened slugs are not accepted by the API.

Input Attributes

AttributeTypeDescription
regionStringOptional region filter. Only returns images available in that region.

Output: images List

Each entry in images contains:
AttributeTypeDescription
slugStringImage slug (use this as the image value in phala_app).
nameStringImage name.
versionStringImage version.
os_image_hashStringImage content hash.
is_devBooleanWhether this is a development image.
regionsList of StringRegions where this image is available.

phala_nodes

Lists available worker nodes (teepods) for CVM placement. Use this when you need to pin a deployment to a specific node with node_id on phala_app.
data "phala_nodes" "west" {
  region = "us-west"
}

output "node_ids" {
  value = data.phala_nodes.west.nodes[*].node_id
}

Input Attributes

AttributeTypeDescription
regionStringOptional region filter.
support_onchain_kmsBooleanOptional filter for nodes that support on-chain KMS.

Output: nodes List

Each entry in nodes contains:
AttributeTypeDescription
node_idNumberNode ID (use this as the node_id value in phala_app).
nameStringNode display name.
regionStringNode region.
device_idStringHardware device identifier.
fmspcStringIntel FMSPC value for this node’s TEE hardware.
listedBooleanWhether the node is publicly listed.
support_onchain_kmsBooleanWhether the node supports on-chain KMS.
remaining_vcpuNumberAvailable vCPU capacity.
remaining_memory_mbNumberAvailable memory in MB.
remaining_cvm_slotsNumberAvailable CVM slots.
resource_scoreNumberComputed resource availability score.
imagesList of StringImage slugs supported on this node.

phala_attestation

Fetches TEE attestation data for a specific CVM on demand. This is a read-only verification data source, not a lifecycle resource.
data "phala_attestation" "web" {
  cvm_id = phala_app.web.primary_cvm_id
}

output "is_online" {
  value = data.phala_attestation.web.is_online
}

output "tcb_info" {
  value = data.phala_attestation.web.tcb_info_json
}

Input Attributes

AttributeTypeDescription
cvm_idStringThe CVM or app identifier to fetch attestation for.

Output Attributes

AttributeTypeDescription
idStringStable state ID (same as cvm_id).
is_onlineBooleanWhether the CVM is currently online.
is_publicBooleanWhether the CVM’s attestation is publicly accessible.
errorStringError message if attestation fetch failed.
compose_fileStringThe compose file content from attestation.
tcb_info_jsonStringRaw TCB info object as JSON string.
app_certificates_jsonStringRaw app certificates array as JSON string.
raw_jsonStringFull attestation response as a JSON string.
Attestation data is fetched fresh on every plan/apply. The raw_json field contains the complete API response if you need fields beyond the top-level attributes.