View in Terraform Registry

Workloads are the fundamental deployment unit on the Azion Platform. They represent your applications and services that are delivered through the global network of edge nodes.


The azion_workload resource allows you to manage workloads through Terraform. Each workload can have multiple deployments, managed by the azion_workload_deployment resource.

Available Resources

ResourceDescription
azion_workloadCreates and manages workloads
azion_workload_deploymentCreates and manages workload deployments

Available Data Sources

Data SourceDescription
azion_workloadsQuery existing workloads

azion_workload

Basic Example

resource "azion_workload" "example" {
name = "my-workload"
# Workload configuration
}

Main Arguments

ArgumentTypeRequiredDescription
namestringYesUnique workload name

For the complete list of arguments, see the Terraform Registry.

Exported Attributes

AttributeTypeDescription
idstringUnique workload ID

azion_workload_deployment

Basic Example

resource "azion_workload" "example" {
name = "my-workload"
}
resource "azion_workload_deployment" "example" {
workload_id = azion_workload.example.id
# Deployment configuration
}

Main Arguments

ArgumentTypeRequiredDescription
workload_idstringYesID of the associated workload

For the complete list of arguments, see the Terraform Registry.


Complete Example

terraform {
required_providers {
azion = {
source = "aziontech/azion"
version = "2.0.0"
}
}
}
provider "azion" {
api_token = var.api_token
}
# Create a workload
resource "azion_workload" "my_app" {
name = "my-application"
}
# Create a deployment for the workload
resource "azion_workload_deployment" "my_app_deployment" {
workload_id = azion_workload.my_app.id
# Additional deployment configuration
}
# Query existing workloads
data "azion_workloads" "all" {}
output "workload_id" {
value = azion_workload.my_app.id
}

Migrating from Domains (V3 to V4)

If you’re migrating from API v3, the azion_domain resource has been replaced by azion_workload and azion_workload_deployment.

Before (V3)

resource "azion_domain" "example" {
name = "my-domain"
edge_application = 12345
domain_name = "example.com"
}

After (V4)

resource "azion_workload" "example" {
name = "my-workload"
}
resource "azion_workload_deployment" "example" {
workload_id = azion_workload.example.id
}

See the Migration Guide for more details.


Next Steps