Terraform is an infrastructure as code tool that makes it possible to manage your infrastructure efficiently through code. The files created to manage your infrastructure can be reused, versioned, and shared, helping you to have a consistent workflow to provision and manage all of your infrastructure throughout its lifecycle.


Terraform Provider v2.0 requires API v4. This version is compatible with Azion API v4 only. If you’re using API v3, see the Terraform Provider v1.x documentation.


How does Azion Terraform Provider work?

Terraform works based on providers. A provider is in charge of managing the lifecycle of a particular resource type. They’re implemented as plugins, which are separate executable code files that may be loaded into Terraform at runtime.

Azion Terraform Provider is an open source project, registered in Terraform Registry that uses the Azion SDK (Go) to communicate with the Azion APIs, so you can manage your infrastructure hosted on the Azion platform, locally, as code.


Process

Azion Terraform Provider Process

Terraform Core: it communicates with the Azion Terraform Provider.

Note: you must have Terraform Core installed in your environment. See how to install it.

Azion Terraform Provider: built in Go, it communicates with the Azion SDK (Go).

Azion SDK (Go): it communicates with the Azion APIs.


First steps

In your .tf file, you must set the Azion Terraform Provider as the provider and set its version as well, such as:

terraform {
required_providers {
azion = {
source = "aziontech/azion"
version = "2.0.0"
}
}
}

With the provider configured, it’s recommended to configure a personal token:

provider "azion" {
api_token = "your-personal-token"
}

Note: if the personal token isn’t provided as presented above, a prompt will ask you to inform it when you try to run any Terraform command.

After these steps, you’re ready to get started managing your infrastructure using the Azion Terraform Provider.


Quick Start Example

Here’s a complete example to get you started with Azion Terraform Provider v2.0:

terraform {
required_providers {
azion = {
source = "aziontech/azion"
version = "2.0.0"
}
}
}
provider "azion" {
api_token = var.api_token
}
# Create a workload
resource "azion_workload" "example" {
name = "my-workload"
# Additional configuration...
}
# Create a connector
resource "azion_connector" "example" {
name = "my-connector"
# Additional configuration...
}
# Create an edge application
resource "azion_edge_application_main_setting" "example" {
name = "my-application"
# Additional configuration...
}

Resources by Category

Workloads

ResourceDescription
azion_workloadManage Azion workloads
azion_workload_deploymentManage workload deployments

Connectors

ResourceDescription
azion_connectorManage Azion connectors

Applications

ResourceDescription
azion_edge_application_main_settingManage application main settings
azion_edge_application_originManage application origins
azion_edge_application_cache_settingManage application cache settings
azion_edge_application_rule_engineManage application rules engine
azion_edge_application_edge_functions_instanceManage application function instances
azion_applicationManage applications

Custom Pages

ResourceDescription
azion_custom_pageManage custom pages

Edge Functions

ResourceDescription
azion_functionManage Edge Functions

Edge DNS

ResourceDescription
azion_intelligent_dns_zoneManage DNS zones
azion_intelligent_dns_recordManage DNS records
azion_intelligent_dns_dnssecManage DNSSEC settings

Security

ResourceDescription
azion_edge_firewall_main_settingManage firewall main settings
azion_edge_firewall_edge_functions_instanceManage firewall function instances
azion_waf_rule_setManage WAF rule sets
azion_network_listManage network lists

Certificates

ResourceDescription
azion_digital_certificateManage digital certificates

Migrating from v1.x

If you’re upgrading from Terraform Provider v1.x (API v3), see the Terraform Provider Migration Guide for detailed instructions on migrating your configurations to v2.0.