Azion Terraform Provider
Manage workloads, connectors, applications, and other Azion resources as code with the Azion Terraform Provider and Azion API v4.
With infrastructure as code, you describe the resources of an account in text files instead of creating them one by one in a web interface. A tool compares those files with what exists and makes the changes for you. Because the description is a set of files, you can reuse it, keep it under version control, and share it. One workflow then provisions and manages the infrastructure through its whole lifecycle. Terraform is a tool of this kind.
Azion Terraform Provider connects Terraform to the Azion Platform, so that your .tf files create, change, and delete the resources of your Azion account. It is an open-source provider published in the Terraform Registry, and version 2.0 works through Azion API v4. Use the Azion Terraform Provider to manage workloads, connectors, applications, DNS zones, firewalls, and certificates from your machine, review every change before it reaches the account, or apply the same configuration from a CI/CD pipeline.
Provider configuration
A Terraform project for Azion declares the provider once and then one block per resource. This configuration pins provider version 2.0.0 and declares a workload:
- The
required_providersblock names the Registry source,aziontech/azion, and a fixed provider version.terraform initinstalls that version. - The
provider "azion"block configures the provider. It stays empty when your personal token is in theAZION_API_TOKENenvironment variable; otherwise theapi_tokenargument passes the token. - Each
resourceblock declares one object of your account. Its type, such asazion_workload, names the kind of object, and its label, such asmy_workload, names it inside the configuration.
The blocks follow the standard Terraform language, so a configuration written for another provider has the same shape. Only the azion_* types change.
Provider architecture
Terraform does not call Azion by itself. It hands each change to the provider, and the provider sends it to Azion API:
- Terraform Core, the program behind the
terraformcommands, reads your.tffiles and works out the changes to make. It passes each change to the Azion Terraform Provider. - The provider sends the requests to Azion API, which creates, updates, deletes, or reads the resources of your account.
Because every change ends as an API request, the provider follows the API version it targets. For the state, the plan and apply cycle, and resource names in detail, refer to How the Terraform Provider works.
Scope and terms
The first four entries define the Terraform terms that every page of this section uses. The rest set the scope of the Azion Terraform Provider:
- Provider: a plugin that manages the lifecycle of specific resource types. A Terraform provider is a separate executable file that Terraform loads at runtime, and
terraform initinstalls it from the Registry source the configuration names. - Resource: a
resourceblock that creates, updates, and deletes one object on Azion. The configuration owns the lifecycle of that object. - Data source: a
datablock that queries objects that already exist on your account and changes nothing. For example, a configuration reads a workload that another configuration manages through a data source, and Terraform never modifies that workload. - State: the record Terraform keeps of every object it manages, which links each resource address to the object on your account. With local state, the record is the
terraform.tfstatefile of the project folder; the Terraform Provider best practices keep it in a remote backend. - Coverage: the provider manages workloads, connectors, applications, Edge DNS zones and records, security resources such as firewalls and network lists, and certificates. Resources and data sources lists every name.
- Requirements: Terraform 1.0 or later, and an Azion personal token with the permissions your resources need.
- Versions: provider version 2.0 pairs with Azion API v4, and version 1.x pairs with API v3. Version 1.x receives no more updates. To move a v1.x configuration to version 2.0, refer to Migrate from provider v1.x to v2.0.
- Other interfaces: you can also manage the same resources with the Azion CLI or directly through Azion API.
- Errors: Troubleshoot the Terraform Provider lists fixes for authentication, version, state, and import errors.