View in Terraform Registry

Manage SSL/TLS digital certificates to protect your applications with HTTPS.


The certificates resources allow you to manage digital certificates for your applications.

Available Resources

ResourceDescription
azion_digital_certificateDigital certificates

Available Data Sources

Data SourceDescription
azion_digital_certificatesQuery existing certificates

azion_digital_certificate

Basic Example

resource "azion_digital_certificate" "example" {
name = "my-certificate"
# Certificate and private key
certificate = file("${path.module}/cert.pem")
private_key = file("${path.module}/key.pem")
}

Main Arguments

ArgumentTypeRequiredDescription
namestringYesCertificate name
certificatestringYesSSL/TLS certificate in PEM format
private_keystringYesPrivate key in PEM format

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

Exported Attributes

AttributeTypeDescription
idstringUnique certificate ID

Complete Example

terraform {
required_providers {
azion = {
source = "aziontech/azion"
version = "2.0.0"
}
}
}
provider "azion" {
api_token = var.api_token
}
# Create digital certificate
resource "azion_digital_certificate" "my_cert" {
name = "certificate-mydomain"
certificate = file("${path.module}/certificates/mydomain.pem")
private_key = file("${path.module}/certificates/mydomain-key.pem")
}
# Query existing certificates
data "azion_digital_certificates" "all" {}
output "certificate_id" {
value = azion_digital_certificate.my_cert.id
}

Using Variables for Certificates

To avoid exposing certificates in code, use variables:

variable "ssl_certificate" {
type = string
description = "SSL certificate in PEM format"
sensitive = true
}
variable "ssl_private_key" {
type = string
description = "SSL private key in PEM format"
sensitive = true
}
resource "azion_digital_certificate" "my_cert" {
name = "my-certificate"
certificate = var.ssl_certificate
private_key = var.ssl_private_key
}