With Auth0, you can use a custom domain to maintain a consistent user experience. This is a three-step process; you must configure the custom domain in Auth0, then create a DNS record for the domain, then verify the DNS record in Auth0. This resource allows for automating the verification part of the process.
# Example of a custom domain managed through DigitalOcean and verified using this resource.
resource "auth0_custom_domain" "my_custom_domain" {
domain = "login.example.com"
type = "auth0_managed_certs"
}
resource "auth0_custom_domain_verification" "my_custom_domain_verification" {
depends_on = [digitalocean_record.my_domain_name_record]
custom_domain_id = auth0_custom_domain.my_custom_domain.id
timeouts { create = "15m" }
}
resource "digitalocean_record" "my_domain_name_record" {
domain = "example.com"
type = upper(auth0_custom_domain.my_custom_domain.verification[0].methods[0].name)
name = "${auth0_custom_domain.my_custom_domain.domain}."
value = "${auth0_custom_domain.my_custom_domain.verification[0].methods[0].record}."
}
custom_domain_id
(String) ID of the custom domain resource.timeouts
(Block, Optional) (see below for nested schema)cname_api_key
(String, Sensitive) The value of the cname-api-key
header to send when forwarding requests. Only present if the type of the custom domain is self_managed_certs
and Terraform originally managed the domain's verification.id
(String) The ID of this resource.origin_domain_name
(String) The DNS name of the Auth0 origin server that handles traffic for the custom domain.timeouts
Optional:
create
(String)auth0_custom_domain_verification
can be used with the depends_on
meta-argument to explicitly wait for the
domain name record (DNS) to be created before attempting to verify the custom domain.
Import is supported using the following syntax:
# You can import this resource using the custom domain ID.
#
# Example:
terraform import auth0_custom_domain_verification.my_custom_domain_verification "cd_XXXXXXXXXXXXXXXX"