ACME Certificate and Account Provider: Basic Example
ACME Certificate and Account Provider: Basic Example
ACME Certificate and Account Provider: Basic Example
com)
Currently the major ACME CA is Let's Encrypt (https://letsencrypt.org), but the ACME support in Terraform can be
configured to use any ACME CA, including an internal one that is set up using Boulder
(https://github.com/letsencrypt/boulder), or another CA that implements the ACME standard with Let's Encrypt's
divergences (https://github.com/letsencrypt/boulder/blob/master/docs/acme-divergences.md).
For more detail on the ACME process, see here (https://letsencrypt.org/how-it-works/). For the ACME spec, click
here (https://ietf-wg-acme.github.io/acme/draft-ietf-acme-acme.html). Note that as mentioned in the last
paragraph, the ACME provider may diverge (https://github.com/letsencrypt/boulder/blob/master/docs/acme-
divergences.md) from the current ACME spec to account for the real-world divergences that are made by CAs
such as Let's Encrypt.
NOTE: The upstream version of the ACME provider supports ACME v2 only. For ACME v1 endpoints, version
0.6.0 is required, which can be found here (https://github.com/vancluever/terraform-provider-
acme/releases/tag/v0.6.0). Note that this version is a 3rd party plugin
(/docs/configuration/providers.html#third-party-plugins) and needs to be installed as such.
Basic Example
The following example can be used to create an account using the acme_registration
(/docs/providers/acme/r/registration.html) resource, and a certificate using the acme_certificate
(/docs/providers/acme/r/certificate.html) resource. The initial private key is created using the tls_private_key
(/docs/providers/tls/r/private_key.html) resource, but can be supplied via other means. DNS validation is
performed by using Amazon Route 53 (https://aws.amazon.com/route53/), for which appropriate credentials are
assumed to be in your environment.
NOTE: The directory URLs in all examples in this provider reference Let's Encrypt's staging server endpoint. For
production use, change the directory URLs to the production endpoints, which can be found here
(https://letsencrypt.org/docs/acme-protocol-updates/).
provider "acme" {
server_url = "https://acme-staging-v02.api.letsencrypt.org/directory"
}
dns_challenge {
provider = "route53"
}
}
Argument Reference
Note that the account key is not a provider-level config value at this time to allow the management of accounts
and certificates within the same provider.
(https://www.hashicorp.com)
For complete information on how to use these providers with the acme_certifiate resource, see here
(/docs/providers/acme/r/certificate.html#using-dns-challenges).
Most provider arguments can be suffixed with _FILE to specify that you wish to store that value in a local file. This
can be useful if local storage for these values is desired over configuration as variables or within the environment.
As an example, if you specify manual configuration for the AWS provider (/docs/providers/aws/index.html) via the
provider (/docs/configuration/providers.html) block instead of the environment, you will still need to supply the
configuration explicitly in the config block of the dns_challenge
(/docs/providers/acme/r/certificate.html#dns_challenge) argument.
Note that some of Terraform's providers have environment variable settings that overlap with the settings here,
generally depending on whether or not these variables are supported by the corresponding provider's SDK.
We alias certain provider environment variables so the same settings can be supplied to both ACME and the
respective native cloud provider. For specific details, see the page for the provider in question.
(https://www.hashicorp.com)
NOTE: The following documentation is auto-generated from the ACME provider's API library lego (https://go-
acme.github.io/lego/). Some sections may refer to lego directly - in most cases, these sections apply to the
Terraform provider as well.
For complete information on how to use this provider with the acme_certifiate resource, see here
(/docs/providers/acme/r/certificate.html#using-dns-challenges).
Example
dns_challenge {
provider = "acme-dns"
}
}
Argument Reference
The following arguments can be either passed as environment variables, or directly through the config block in
the dns_challenge (/docs/providers/acme/r/certificate.html#dns_challenge) argument in the
acme_certificate (/docs/providers/acme/r/certificate.html) resource. For more details, see here
(/docs/providers/acme/r/certificate.html#using-dns-challenges).
In addition, arguments can also be stored in a local file, with the path supplied by supplying the argument with the
_FILE suffix. See here (/docs/providers/acme/r/certificate.html#using-variable-files-for-provider-arguments)
for more information.
ACME_DNS_STORAGE_PATH - The ACME-DNS JSON account data file. A per-domain account will be
registered/persisted to this file and used for TXT updates..
(https://www.hashicorp.com)
NOTE: The following documentation is auto-generated from the ACME provider's API library lego (https://go-
acme.github.io/lego/). Some sections may refer to lego directly - in most cases, these sections apply to the
Terraform provider as well.
For complete information on how to use this provider with the acme_certifiate resource, see here
(/docs/providers/acme/r/certificate.html#using-dns-challenges).
Example
dns_challenge {
provider = "alidns"
}
}
Argument Reference
The following arguments can be either passed as environment variables, or directly through the config block in
the dns_challenge (/docs/providers/acme/r/certificate.html#dns_challenge) argument in the
acme_certificate (/docs/providers/acme/r/certificate.html) resource. For more details, see here
(/docs/providers/acme/r/certificate.html#using-dns-challenges).
In addition, arguments can also be stored in a local file, with the path supplied by supplying the argument with the
_FILE suffix. See here (/docs/providers/acme/r/certificate.html#using-variable-files-for-provider-arguments)
for more information.
ALICLOUD_TTL - The TTL of the TXT record used for the DNS challenge.
(https://www.hashicorp.com)
NOTE: The following documentation is auto-generated from the ACME provider's API library lego (https://go-
acme.github.io/lego/). Some sections may refer to lego directly - in most cases, these sections apply to the
Terraform provider as well.
For complete information on how to use this provider with the acme_certifiate resource, see here
(/docs/providers/acme/r/certificate.html#using-dns-challenges).
Example
dns_challenge {
provider = "auroradns"
}
}
Argument Reference
The following arguments can be either passed as environment variables, or directly through the config block in
the dns_challenge (/docs/providers/acme/r/certificate.html#dns_challenge) argument in the
acme_certificate (/docs/providers/acme/r/certificate.html) resource. For more details, see here
(/docs/providers/acme/r/certificate.html#using-dns-challenges).
In addition, arguments can also be stored in a local file, with the path supplied by supplying the argument with the
_FILE suffix. See here (/docs/providers/acme/r/certificate.html#using-variable-files-for-provider-arguments)
for more information.
AURORA_TTL - The TTL of the TXT record used for the DNS challenge.
(https://www.hashicorp.com)
NOTE: The following documentation is auto-generated from the ACME provider's API library lego (https://go-
acme.github.io/lego/). Some sections may refer to lego directly - in most cases, these sections apply to the
Terraform provider as well.
For complete information on how to use this provider with the acme_certifiate resource, see here
(/docs/providers/acme/r/certificate.html#using-dns-challenges).
Example
dns_challenge {
provider = "azure"
}
}
Argument Reference
The following arguments can be either passed as environment variables, or directly through the config block in
the dns_challenge (/docs/providers/acme/r/certificate.html#dns_challenge) argument in the
acme_certificate (/docs/providers/acme/r/certificate.html) resource. For more details, see here
(/docs/providers/acme/r/certificate.html#using-dns-challenges).
In addition, arguments can also be stored in a local file, with the path supplied by supplying the argument with the
_FILE suffix. See here (/docs/providers/acme/r/certificate.html#using-variable-files-for-provider-arguments)
for more information.
instance metadata service - If the credentials are not set via the environment, then it will attempt to get a
bearer token via the instance metadata service (https://docs.microsoft.com/en-us/azure/virtual-
machines/windows/instance-metadata-service)..
AZURE_TTL - The TTL of the TXT record used for the DNS challenge.
The following variables are Terraform-specific aliases for the above configuration values:
NOTE: The following documentation is auto-generated from the ACME provider's API library lego (https://go-
acme.github.io/lego/). Some sections may refer to lego directly - in most cases, these sections apply to the
Terraform provider as well.
For complete information on how to use this provider with the acme_certifiate resource, see here
(/docs/providers/acme/r/certificate.html#using-dns-challenges).
Example
dns_challenge {
provider = "bindman"
}
}
Argument Reference
The following arguments can be either passed as environment variables, or directly through the config block in
the dns_challenge (/docs/providers/acme/r/certificate.html#dns_challenge) argument in the
acme_certificate (/docs/providers/acme/r/certificate.html) resource. For more details, see here
(/docs/providers/acme/r/certificate.html#using-dns-challenges).
In addition, arguments can also be stored in a local file, with the path supplied by supplying the argument with the
_FILE suffix. See here (/docs/providers/acme/r/certificate.html#using-variable-files-for-provider-arguments)
for more information.
BINDMAN_MANAGER_ADDRESS - The server URL, should have scheme, hostname, and port (if required) of the
Bindman-DNS Manager server.
NOTE: The following documentation is auto-generated from the ACME provider's API library lego (https://go-
acme.github.io/lego/). Some sections may refer to lego directly - in most cases, these sections apply to the
Terraform provider as well.
For complete information on how to use this provider with the acme_certifiate resource, see here
(/docs/providers/acme/r/certificate.html#using-dns-challenges).
Example
dns_challenge {
provider = "bluecat"
}
}
Argument Reference
The following arguments can be either passed as environment variables, or directly through the config block in
the dns_challenge (/docs/providers/acme/r/certificate.html#dns_challenge) argument in the
acme_certificate (/docs/providers/acme/r/certificate.html) resource. For more details, see here
(/docs/providers/acme/r/certificate.html#using-dns-challenges).
In addition, arguments can also be stored in a local file, with the path supplied by supplying the argument with the
_FILE suffix. See here (/docs/providers/acme/r/certificate.html#using-variable-files-for-provider-arguments)
for more information.
BLUECAT_SERVER_URL - The server URL, should have scheme, hostname, and port (if required) of the
authoritative Bluecat BAM serve.
BLUECAT_TTL - The TTL of the TXT record used for the DNS challenge.
(https://www.hashicorp.com)
NOTE: The following documentation is auto-generated from the ACME provider's API library lego (https://go-
acme.github.io/lego/). Some sections may refer to lego directly - in most cases, these sections apply to the
Terraform provider as well.
For complete information on how to use this provider with the acme_certifiate resource, see here
(/docs/providers/acme/r/certificate.html#using-dns-challenges).
Example
dns_challenge {
provider = "cloudflare"
}
}
Argument Reference
The following arguments can be either passed as environment variables, or directly through the config block in
the dns_challenge (/docs/providers/acme/r/certificate.html#dns_challenge) argument in the
acme_certificate (/docs/providers/acme/r/certificate.html) resource. For more details, see here
(/docs/providers/acme/r/certificate.html#using-dns-challenges).
In addition, arguments can also be stored in a local file, with the path supplied by supplying the argument with the
_FILE suffix. See here (/docs/providers/acme/r/certificate.html#using-variable-files-for-provider-arguments)
for more information.
CLOUDFLARE_TTL - The TTL of the TXT record used for the DNS challenge.
Description
You may use CF_API_EMAIL and CF_API_KEY to authenticate, or CF_DNS_API_TOKEN , or CF_DNS_API_TOKEN and
CF_ZONE_API_TOKEN .
API keys
If using API keys ( CF_API_EMAIL and CF_API_KEY ), the Global API Key needs to be used, not the Origin CA Key.
Please be aware, that this in principle allows Lego to read and change everything related to this account.
API tokens
With API tokens ( CF_DNS_API_TOKEN , and optionally CF_ZONE_API_TOKEN ), very specific access can be granted to
your resources at Cloudflare. See this Cloudflare announcement (https://blog.cloudflare.com/api-tokens-general-
availability/) for details.
The main resources Lego cares for are the DNS entries for your Zones. It also need to resolve a domain name to an
internal Zone ID in order to manipulate DNS entries.
Hence, you should create an API token with the following permissions:
You also need to scope the access to all your domains for this to work. Then pass the API token as
CF_DNS_API_TOKEN to Lego.
Alternatively, if you prefer a more strict set of privileges, you can split the access tokens:
Create one with Zone / Zone / Read permissions and scope it to all your zones. This is needed to resolve
domain names to Zone IDs and can be shared among multiple Lego installations. Pass this API token as
CF_ZONE_API_TOKEN to Lego.
Create another API token with Zone / DNS / Edit permissions and set the scope to the domains you want to
manage with a single Lego installation. Pass this token as CF_DNS_API_TOKEN to Lego.
Repeat the previous step for each host you want to run Lego on.
This "paranoid" setup is mainly interesting for users who manage many zones/domains with a single Cloudflare
account. It follows the principle of least privilege and limits the possible damage, should one of the hosts become
compromised.
(https://www.hashicorp.com)
NOTE: The following documentation is auto-generated from the ACME provider's API library lego (https://go-
acme.github.io/lego/). Some sections may refer to lego directly - in most cases, these sections apply to the
Terraform provider as well.
For complete information on how to use this provider with the acme_certifiate resource, see here
(/docs/providers/acme/r/certificate.html#using-dns-challenges).
Example
dns_challenge {
provider = "cloudns"
}
}
Argument Reference
The following arguments can be either passed as environment variables, or directly through the config block in
the dns_challenge (/docs/providers/acme/r/certificate.html#dns_challenge) argument in the
acme_certificate (/docs/providers/acme/r/certificate.html) resource. For more details, see here
(/docs/providers/acme/r/certificate.html#using-dns-challenges).
In addition, arguments can also be stored in a local file, with the path supplied by supplying the argument with the
_FILE suffix. See here (/docs/providers/acme/r/certificate.html#using-variable-files-for-provider-arguments)
for more information.
CLOUDNS_TTL - The TTL of the TXT record used for the DNS challenge.
(https://www.hashicorp.com)
NOTE: The following documentation is auto-generated from the ACME provider's API library lego (https://go-
acme.github.io/lego/). Some sections may refer to lego directly - in most cases, these sections apply to the
Terraform provider as well.
For complete information on how to use this provider with the acme_certifiate resource, see here
(/docs/providers/acme/r/certificate.html#using-dns-challenges).
Example
dns_challenge {
provider = "cloudxns"
}
}
Argument Reference
The following arguments can be either passed as environment variables, or directly through the config block in
the dns_challenge (/docs/providers/acme/r/certificate.html#dns_challenge) argument in the
acme_certificate (/docs/providers/acme/r/certificate.html) resource. For more details, see here
(/docs/providers/acme/r/certificate.html#using-dns-challenges).
In addition, arguments can also be stored in a local file, with the path supplied by supplying the argument with the
_FILE suffix. See here (/docs/providers/acme/r/certificate.html#using-variable-files-for-provider-arguments)
for more information.
CLOUDXNS_TTL - The TTL of the TXT record used for the DNS challenge.
(https://www.hashicorp.com)
NOTE: The following documentation is auto-generated from the ACME provider's API library lego (https://go-
acme.github.io/lego/). Some sections may refer to lego directly - in most cases, these sections apply to the
Terraform provider as well.
For complete information on how to use this provider with the acme_certifiate resource, see here
(/docs/providers/acme/r/certificate.html#using-dns-challenges).
Example
dns_challenge {
provider = "conoha"
}
}
Argument Reference
The following arguments can be either passed as environment variables, or directly through the config block in
the dns_challenge (/docs/providers/acme/r/certificate.html#dns_challenge) argument in the
acme_certificate (/docs/providers/acme/r/certificate.html) resource. For more details, see here
(/docs/providers/acme/r/certificate.html#using-dns-challenges).
In addition, arguments can also be stored in a local file, with the path supplied by supplying the argument with the
_FILE suffix. See here (/docs/providers/acme/r/certificate.html#using-variable-files-for-provider-arguments)
for more information.
CONOHA_TTL - The TTL of the TXT record used for the DNS challenge.
(https://www.hashicorp.com)
NOTE: The following documentation is auto-generated from the ACME provider's API library lego (https://go-
acme.github.io/lego/). Some sections may refer to lego directly - in most cases, these sections apply to the
Terraform provider as well.
For complete information on how to use this provider with the acme_certifiate resource, see here
(/docs/providers/acme/r/certificate.html#using-dns-challenges).
Example
dns_challenge {
provider = "designate"
}
}
Argument Reference
The following arguments can be either passed as environment variables, or directly through the config block in
the dns_challenge (/docs/providers/acme/r/certificate.html#dns_challenge) argument in the
acme_certificate (/docs/providers/acme/r/certificate.html) resource. For more details, see here
(/docs/providers/acme/r/certificate.html#using-dns-challenges).
In addition, arguments can also be stored in a local file, with the path supplied by supplying the argument with the
_FILE suffix. See here (/docs/providers/acme/r/certificate.html#using-variable-files-for-provider-arguments)
for more information.
OS_PASSWORD - Password.
OS_USERNAME - Username.
DESIGNATE_TTL - The TTL of the TXT record used for the DNS challenge.
NOTE: The following documentation is auto-generated from the ACME provider's API library lego (https://go-
acme.github.io/lego/). Some sections may refer to lego directly - in most cases, these sections apply to the
Terraform provider as well.
For complete information on how to use this provider with the acme_certifiate resource, see here
(/docs/providers/acme/r/certificate.html#using-dns-challenges).
Example
dns_challenge {
provider = "digitalocean"
}
}
Argument Reference
The following arguments can be either passed as environment variables, or directly through the config block in
the dns_challenge (/docs/providers/acme/r/certificate.html#dns_challenge) argument in the
acme_certificate (/docs/providers/acme/r/certificate.html) resource. For more details, see here
(/docs/providers/acme/r/certificate.html#using-dns-challenges).
In addition, arguments can also be stored in a local file, with the path supplied by supplying the argument with the
_FILE suffix. See here (/docs/providers/acme/r/certificate.html#using-variable-files-for-provider-arguments)
for more information.
DO_TTL - The TTL of the TXT record used for the DNS challenge.
(https://www.hashicorp.com)
NOTE: The following documentation is auto-generated from the ACME provider's API library lego (https://go-
acme.github.io/lego/). Some sections may refer to lego directly - in most cases, these sections apply to the
Terraform provider as well.
For complete information on how to use this provider with the acme_certifiate resource, see here
(/docs/providers/acme/r/certificate.html#using-dns-challenges).
Example
dns_challenge {
provider = "dnsimple"
}
}
Argument Reference
The following arguments can be either passed as environment variables, or directly through the config block in
the dns_challenge (/docs/providers/acme/r/certificate.html#dns_challenge) argument in the
acme_certificate (/docs/providers/acme/r/certificate.html) resource. For more details, see here
(/docs/providers/acme/r/certificate.html#using-dns-challenges).
In addition, arguments can also be stored in a local file, with the path supplied by supplying the argument with the
_FILE suffix. See here (/docs/providers/acme/r/certificate.html#using-variable-files-for-provider-arguments)
for more information.
NOTE: The following documentation is auto-generated from the ACME provider's API library lego (https://go-
acme.github.io/lego/). Some sections may refer to lego directly - in most cases, these sections apply to the
Terraform provider as well.
For complete information on how to use this provider with the acme_certifiate resource, see here
(/docs/providers/acme/r/certificate.html#using-dns-challenges).
Example
dns_challenge {
provider = "dnsmadeeasy"
}
}
Argument Reference
The following arguments can be either passed as environment variables, or directly through the config block in
the dns_challenge (/docs/providers/acme/r/certificate.html#dns_challenge) argument in the
acme_certificate (/docs/providers/acme/r/certificate.html) resource. For more details, see here
(/docs/providers/acme/r/certificate.html#using-dns-challenges).
In addition, arguments can also be stored in a local file, with the path supplied by supplying the argument with the
_FILE suffix. See here (/docs/providers/acme/r/certificate.html#using-variable-files-for-provider-arguments)
for more information.
DNSMADEEASY_TTL - The TTL of the TXT record used for the DNS challenge.
(https://www.hashicorp.com)
NOTE: The following documentation is auto-generated from the ACME provider's API library lego (https://go-
acme.github.io/lego/). Some sections may refer to lego directly - in most cases, these sections apply to the
Terraform provider as well.
For complete information on how to use this provider with the acme_certifiate resource, see here
(/docs/providers/acme/r/certificate.html#using-dns-challenges).
Example
dns_challenge {
provider = "dnspod"
}
}
Argument Reference
The following arguments can be either passed as environment variables, or directly through the config block in
the dns_challenge (/docs/providers/acme/r/certificate.html#dns_challenge) argument in the
acme_certificate (/docs/providers/acme/r/certificate.html) resource. For more details, see here
(/docs/providers/acme/r/certificate.html#using-dns-challenges).
In addition, arguments can also be stored in a local file, with the path supplied by supplying the argument with the
_FILE suffix. See here (/docs/providers/acme/r/certificate.html#using-variable-files-for-provider-arguments)
for more information.
NOTE: The following documentation is auto-generated from the ACME provider's API library lego (https://go-
acme.github.io/lego/). Some sections may refer to lego directly - in most cases, these sections apply to the
Terraform provider as well.
For complete information on how to use this provider with the acme_certifiate resource, see here
(/docs/providers/acme/r/certificate.html#using-dns-challenges).
Example
dns_challenge {
provider = "dode"
}
}
Argument Reference
The following arguments can be either passed as environment variables, or directly through the config block in
the dns_challenge (/docs/providers/acme/r/certificate.html#dns_challenge) argument in the
acme_certificate (/docs/providers/acme/r/certificate.html) resource. For more details, see here
(/docs/providers/acme/r/certificate.html#using-dns-challenges).
In addition, arguments can also be stored in a local file, with the path supplied by supplying the argument with the
_FILE suffix. See here (/docs/providers/acme/r/certificate.html#using-variable-files-for-provider-arguments)
for more information.
DODE_TTL - The TTL of the TXT record used for the DNS challenge.
(https://www.hashicorp.com)
NOTE: The following documentation is auto-generated from the ACME provider's API library lego (https://go-
acme.github.io/lego/). Some sections may refer to lego directly - in most cases, these sections apply to the
Terraform provider as well.
For complete information on how to use this provider with the acme_certifiate resource, see here
(/docs/providers/acme/r/certificate.html#using-dns-challenges).
Example
dns_challenge {
provider = "dreamhost"
}
}
Argument Reference
The following arguments can be either passed as environment variables, or directly through the config block in
the dns_challenge (/docs/providers/acme/r/certificate.html#dns_challenge) argument in the
acme_certificate (/docs/providers/acme/r/certificate.html) resource. For more details, see here
(/docs/providers/acme/r/certificate.html#using-dns-challenges).
In addition, arguments can also be stored in a local file, with the path supplied by supplying the argument with the
_FILE suffix. See here (/docs/providers/acme/r/certificate.html#using-variable-files-for-provider-arguments)
for more information.
NOTE: The following documentation is auto-generated from the ACME provider's API library lego (https://go-
acme.github.io/lego/). Some sections may refer to lego directly - in most cases, these sections apply to the
Terraform provider as well.
For complete information on how to use this provider with the acme_certifiate resource, see here
(/docs/providers/acme/r/certificate.html#using-dns-challenges).
Example
dns_challenge {
provider = "duckdns"
}
}
Argument Reference
The following arguments can be either passed as environment variables, or directly through the config block in
the dns_challenge (/docs/providers/acme/r/certificate.html#dns_challenge) argument in the
acme_certificate (/docs/providers/acme/r/certificate.html) resource. For more details, see here
(/docs/providers/acme/r/certificate.html#using-dns-challenges).
In addition, arguments can also be stored in a local file, with the path supplied by supplying the argument with the
_FILE suffix. See here (/docs/providers/acme/r/certificate.html#using-variable-files-for-provider-arguments)
for more information.
DUCKDNS_TTL - The TTL of the TXT record used for the DNS challenge.
(https://www.hashicorp.com)
NOTE: The following documentation is auto-generated from the ACME provider's API library lego (https://go-
acme.github.io/lego/). Some sections may refer to lego directly - in most cases, these sections apply to the
Terraform provider as well.
For complete information on how to use this provider with the acme_certifiate resource, see here
(/docs/providers/acme/r/certificate.html#using-dns-challenges).
Example
dns_challenge {
provider = "dyn"
}
}
Argument Reference
The following arguments can be either passed as environment variables, or directly through the config block in
the dns_challenge (/docs/providers/acme/r/certificate.html#dns_challenge) argument in the
acme_certificate (/docs/providers/acme/r/certificate.html) resource. For more details, see here
(/docs/providers/acme/r/certificate.html#using-dns-challenges).
In addition, arguments can also be stored in a local file, with the path supplied by supplying the argument with the
_FILE suffix. See here (/docs/providers/acme/r/certificate.html#using-variable-files-for-provider-arguments)
for more information.
DYN_PASSWORD - Paswword.
DYN_TTL - The TTL of the TXT record used for the DNS challenge.
(https://www.hashicorp.com)
NOTE: The following documentation is auto-generated from the ACME provider's API library lego (https://go-
acme.github.io/lego/). Some sections may refer to lego directly - in most cases, these sections apply to the
Terraform provider as well.
For complete information on how to use this provider with the acme_certifiate resource, see here
(/docs/providers/acme/r/certificate.html#using-dns-challenges).
Example
dns_challenge {
provider = "namedotcom"
}
}
Argument Reference
The following arguments can be either passed as environment variables, or directly through the config block in
the dns_challenge (/docs/providers/acme/r/certificate.html#dns_challenge) argument in the
acme_certificate (/docs/providers/acme/r/certificate.html) resource. For more details, see here
(/docs/providers/acme/r/certificate.html#using-dns-challenges).
In addition, arguments can also be stored in a local file, with the path supplied by supplying the argument with the
_FILE suffix. See here (/docs/providers/acme/r/certificate.html#using-variable-files-for-provider-arguments)
for more information.
NAMECOM_USERNAME - Username.
NAMECOM_TTL - The TTL of the TXT record used for the DNS challenge.
(https://www.hashicorp.com)
NOTE: The following documentation is auto-generated from the ACME provider's API library lego (https://go-
acme.github.io/lego/). Some sections may refer to lego directly - in most cases, these sections apply to the
Terraform provider as well.
For complete information on how to use this provider with the acme_certifiate resource, see here
(/docs/providers/acme/r/certificate.html#using-dns-challenges).
Example
dns_challenge {
provider = "namesilo"
}
}
Argument Reference
The following arguments can be either passed as environment variables, or directly through the config block in
the dns_challenge (/docs/providers/acme/r/certificate.html#dns_challenge) argument in the
acme_certificate (/docs/providers/acme/r/certificate.html) resource. For more details, see here
(/docs/providers/acme/r/certificate.html#using-dns-challenges).
In addition, arguments can also be stored in a local file, with the path supplied by supplying the argument with the
_FILE suffix. See here (/docs/providers/acme/r/certificate.html#using-variable-files-for-provider-arguments)
for more information.
NAMESILO_PROPAGATION_TIMEOUT - Maximum waiting time for DNS propagation, it is better to set larger than
15m.
NAMESILO_TTL - The TTL of the TXT record used for the DNS challenge, should be in [3600, 2592000].
(https://www.hashicorp.com)
NOTE: The following documentation is auto-generated from the ACME provider's API library lego (https://go-
acme.github.io/lego/). Some sections may refer to lego directly - in most cases, these sections apply to the
Terraform provider as well.
For complete information on how to use this provider with the acme_certifiate resource, see here
(/docs/providers/acme/r/certificate.html#using-dns-challenges).
Example
dns_challenge {
provider = "netcup"
}
}
Argument Reference
The following arguments can be either passed as environment variables, or directly through the config block in
the dns_challenge (/docs/providers/acme/r/certificate.html#dns_challenge) argument in the
acme_certificate (/docs/providers/acme/r/certificate.html) resource. For more details, see here
(/docs/providers/acme/r/certificate.html#using-dns-challenges).
In addition, arguments can also be stored in a local file, with the path supplied by supplying the argument with the
_FILE suffix. See here (/docs/providers/acme/r/certificate.html#using-variable-files-for-provider-arguments)
for more information.
NETCUP_TTL - The TTL of the TXT record used for the DNS challenge.
(https://www.hashicorp.com)
NOTE: The following documentation is auto-generated from the ACME provider's API library lego (https://go-
acme.github.io/lego/). Some sections may refer to lego directly - in most cases, these sections apply to the
Terraform provider as well.
For complete information on how to use this provider with the acme_certifiate resource, see here
(/docs/providers/acme/r/certificate.html#using-dns-challenges).
Example
dns_challenge {
provider = "nifcloud"
}
}
Argument Reference
The following arguments can be either passed as environment variables, or directly through the config block in
the dns_challenge (/docs/providers/acme/r/certificate.html#dns_challenge) argument in the
acme_certificate (/docs/providers/acme/r/certificate.html) resource. For more details, see here
(/docs/providers/acme/r/certificate.html#using-dns-challenges).
In addition, arguments can also be stored in a local file, with the path supplied by supplying the argument with the
_FILE suffix. See here (/docs/providers/acme/r/certificate.html#using-variable-files-for-provider-arguments)
for more information.
NIFCLOUD_TTL - The TTL of the TXT record used for the DNS challenge.
(https://www.hashicorp.com)
NOTE: The following documentation is auto-generated from the ACME provider's API library lego (https://go-
acme.github.io/lego/). Some sections may refer to lego directly - in most cases, these sections apply to the
Terraform provider as well.
For complete information on how to use this provider with the acme_certifiate resource, see here
(/docs/providers/acme/r/certificate.html#using-dns-challenges).
Example
dns_challenge {
provider = "ns1"
}
}
Argument Reference
The following arguments can be either passed as environment variables, or directly through the config block in
the dns_challenge (/docs/providers/acme/r/certificate.html#dns_challenge) argument in the
acme_certificate (/docs/providers/acme/r/certificate.html) resource. For more details, see here
(/docs/providers/acme/r/certificate.html#using-dns-challenges).
In addition, arguments can also be stored in a local file, with the path supplied by supplying the argument with the
_FILE suffix. See here (/docs/providers/acme/r/certificate.html#using-variable-files-for-provider-arguments)
for more information.
NOTE: The following documentation is auto-generated from the ACME provider's API library lego (https://go-
acme.github.io/lego/). Some sections may refer to lego directly - in most cases, these sections apply to the
Terraform provider as well.
For complete information on how to use this provider with the acme_certifiate resource, see here
(/docs/providers/acme/r/certificate.html#using-dns-challenges).
Example
dns_challenge {
provider = "oraclecloud"
}
}
Argument Reference
The following arguments can be either passed as environment variables, or directly through the config block in
the dns_challenge (/docs/providers/acme/r/certificate.html#dns_challenge) argument in the
acme_certificate (/docs/providers/acme/r/certificate.html) resource. For more details, see here
(/docs/providers/acme/r/certificate.html#using-dns-challenges).
In addition, arguments can also be stored in a local file, with the path supplied by supplying the argument with the
_FILE suffix. See here (/docs/providers/acme/r/certificate.html#using-variable-files-for-provider-arguments)
for more information.
OCI_TTL - The TTL of the TXT record used for the DNS challenge.
(https://www.hashicorp.com)
NOTE: The following documentation is auto-generated from the ACME provider's API library lego (https://go-
acme.github.io/lego/). Some sections may refer to lego directly - in most cases, these sections apply to the
Terraform provider as well.
For complete information on how to use this provider with the acme_certifiate resource, see here
(/docs/providers/acme/r/certificate.html#using-dns-challenges).
Example
dns_challenge {
provider = "otc"
}
}
Argument Reference
The following arguments can be either passed as environment variables, or directly through the config block in
the dns_challenge (/docs/providers/acme/r/certificate.html#dns_challenge) argument in the
acme_certificate (/docs/providers/acme/r/certificate.html) resource. For more details, see here
(/docs/providers/acme/r/certificate.html#using-dns-challenges).
In addition, arguments can also be stored in a local file, with the path supplied by supplying the argument with the
_FILE suffix. See here (/docs/providers/acme/r/certificate.html#using-variable-files-for-provider-arguments)
for more information.
OTC_PASSWORD - Password.
OTC_TTL - The TTL of the TXT record used for the DNS challenge.
(https://www.hashicorp.com)
NOTE: The following documentation is auto-generated from the ACME provider's API library lego (https://go-
acme.github.io/lego/). Some sections may refer to lego directly - in most cases, these sections apply to the
Terraform provider as well.
For complete information on how to use this provider with the acme_certifiate resource, see here
(/docs/providers/acme/r/certificate.html#using-dns-challenges).
Example
dns_challenge {
provider = "ovh"
}
}
Argument Reference
The following arguments can be either passed as environment variables, or directly through the config block in
the dns_challenge (/docs/providers/acme/r/certificate.html#dns_challenge) argument in the
acme_certificate (/docs/providers/acme/r/certificate.html) resource. For more details, see here
(/docs/providers/acme/r/certificate.html#using-dns-challenges).
In addition, arguments can also be stored in a local file, with the path supplied by supplying the argument with the
_FILE suffix. See here (/docs/providers/acme/r/certificate.html#using-variable-files-for-provider-arguments)
for more information.
OVH_TTL - The TTL of the TXT record used for the DNS challenge.
(https://www.hashicorp.com)
NOTE: The following documentation is auto-generated from the ACME provider's API library lego (https://go-
acme.github.io/lego/). Some sections may refer to lego directly - in most cases, these sections apply to the
Terraform provider as well.
For complete information on how to use this provider with the acme_certifiate resource, see here
(/docs/providers/acme/r/certificate.html#using-dns-challenges).
Example
dns_challenge {
provider = "pdns"
}
}
Argument Reference
The following arguments can be either passed as environment variables, or directly through the config block in
the dns_challenge (/docs/providers/acme/r/certificate.html#dns_challenge) argument in the
acme_certificate (/docs/providers/acme/r/certificate.html) resource. For more details, see here
(/docs/providers/acme/r/certificate.html#using-dns-challenges).
In addition, arguments can also be stored in a local file, with the path supplied by supplying the argument with the
_FILE suffix. See here (/docs/providers/acme/r/certificate.html#using-variable-files-for-provider-arguments)
for more information.
PDNS_TTL - The TTL of the TXT record used for the DNS challenge.
Information
Tested and confirmed to work with PowerDNS authoritative server 3.4.8 and 4.0.1. Refer to PowerDNS
documentation (https://doc.powerdns.com/md/httpapi/README/) instructions on how to enable the built-in API
interface.
PowerDNS Notes: - PowerDNS API does not currently support SSL, therefore you should take care to ensure that
traffic between lego and the PowerDNS API is over a trusted network, VPN etc. - In order to have the SOA serial
automatically increment each time the _acme-challenge record is added/modified via the API, set SOA-EDIT-API
to INCEPTION-INCREMENT for the zone in the domainmetadata table
(https://www.hashicorp.com)
NOTE: The following documentation is auto-generated from the ACME provider's API library lego (https://go-
acme.github.io/lego/). Some sections may refer to lego directly - in most cases, these sections apply to the
Terraform provider as well.
For complete information on how to use this provider with the acme_certifiate resource, see here
(/docs/providers/acme/r/certificate.html#using-dns-challenges).
Example
dns_challenge {
provider = "rackspace"
}
}
Argument Reference
The following arguments can be either passed as environment variables, or directly through the config block in
the dns_challenge (/docs/providers/acme/r/certificate.html#dns_challenge) argument in the
acme_certificate (/docs/providers/acme/r/certificate.html) resource. For more details, see here
(/docs/providers/acme/r/certificate.html#using-dns-challenges).
In addition, arguments can also be stored in a local file, with the path supplied by supplying the argument with the
_FILE suffix. See here (/docs/providers/acme/r/certificate.html#using-variable-files-for-provider-arguments)
for more information.
RACKSPACE_TTL - The TTL of the TXT record used for the DNS challenge.
(https://www.hashicorp.com)
NOTE: The following documentation is auto-generated from the ACME provider's API library lego (https://go-
acme.github.io/lego/). Some sections may refer to lego directly - in most cases, these sections apply to the
Terraform provider as well.
For complete information on how to use this provider with the acme_certifiate resource, see here
(/docs/providers/acme/r/certificate.html#using-dns-challenges).
Example
dns_challenge {
provider = "rfc2136"
}
}
Argument Reference
The following arguments can be either passed as environment variables, or directly through the config block in
the dns_challenge (/docs/providers/acme/r/certificate.html#dns_challenge) argument in the
acme_certificate (/docs/providers/acme/r/certificate.html) resource. For more details, see here
(/docs/providers/acme/r/certificate.html#using-dns-challenges).
In addition, arguments can also be stored in a local file, with the path supplied by supplying the argument with the
_FILE suffix. See here (/docs/providers/acme/r/certificate.html#using-variable-files-for-provider-arguments)
for more information.
RFC2136_TSIG_SECRET - Secret key payload. To disable TSIG authentication, leave the RFC2136_TSIG*
variables unset..
RFC2136_TTL - The TTL of the TXT record used for the DNS challenge.
(https://www.hashicorp.com)
NOTE: The following documentation is auto-generated from the ACME provider's API library lego (https://go-
acme.github.io/lego/). Some sections may refer to lego directly - in most cases, these sections apply to the
Terraform provider as well.
For complete information on how to use this provider with the acme_certifiate resource, see here
(/docs/providers/acme/r/certificate.html#using-dns-challenges).
Example
dns_challenge {
provider = "route53"
}
}
Argument Reference
The following arguments can be either passed as environment variables, or directly through the config block in
the dns_challenge (/docs/providers/acme/r/certificate.html#dns_challenge) argument in the
acme_certificate (/docs/providers/acme/r/certificate.html) resource. For more details, see here
(/docs/providers/acme/r/certificate.html#using-dns-challenges).
In addition, arguments can also be stored in a local file, with the path supplied by supplying the argument with the
_FILE suffix. See here (/docs/providers/acme/r/certificate.html#using-variable-files-for-provider-arguments)
for more information.
AWS_TTL - The TTL of the TXT record used for the DNS challenge.
Description
AWS Credentials are automatically detected in the following locations and prioritized in the following order:
If AWS_HOSTED_ZONE_ID is not set, Lego tries to determine the correct public hosted zone via the FQDN.
Policy
The following AWS IAM policy document describes the permissions required for lego to complete the DNS
challenge.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "",
"Effect": "Allow",
"Action": [
"route53:GetChange",
"route53:ChangeResourceRecordSets",
"route53:ListResourceRecordSets"
],
"Resource": [
"arn:aws:route53:::hostedzone/*",
"arn:aws:route53:::change/*"
]
},
{
"Sid": "",
"Effect": "Allow",
"Action": "route53:ListHostedZonesByName",
"Resource": "*"
}
]
}
(https://www.hashicorp.com)
NOTE: The following documentation is auto-generated from the ACME provider's API library lego (https://go-
acme.github.io/lego/). Some sections may refer to lego directly - in most cases, these sections apply to the
Terraform provider as well.
For complete information on how to use this provider with the acme_certifiate resource, see here
(/docs/providers/acme/r/certificate.html#using-dns-challenges).
Example
dns_challenge {
provider = "sakuracloud"
}
}
Argument Reference
The following arguments can be either passed as environment variables, or directly through the config block in
the dns_challenge (/docs/providers/acme/r/certificate.html#dns_challenge) argument in the
acme_certificate (/docs/providers/acme/r/certificate.html) resource. For more details, see here
(/docs/providers/acme/r/certificate.html#using-dns-challenges).
In addition, arguments can also be stored in a local file, with the path supplied by supplying the argument with the
_FILE suffix. See here (/docs/providers/acme/r/certificate.html#using-variable-files-for-provider-arguments)
for more information.
SAKURACLOUD_TTL - The TTL of the TXT record used for the DNS challenge.
(https://www.hashicorp.com)
NOTE: The following documentation is auto-generated from the ACME provider's API library lego (https://go-
acme.github.io/lego/). Some sections may refer to lego directly - in most cases, these sections apply to the
Terraform provider as well.
For complete information on how to use this provider with the acme_certifiate resource, see here
(/docs/providers/acme/r/certificate.html#using-dns-challenges).
Example
dns_challenge {
provider = "selectel"
}
}
Argument Reference
The following arguments can be either passed as environment variables, or directly through the config block in
the dns_challenge (/docs/providers/acme/r/certificate.html#dns_challenge) argument in the
acme_certificate (/docs/providers/acme/r/certificate.html) resource. For more details, see here
(/docs/providers/acme/r/certificate.html#using-dns-challenges).
In addition, arguments can also be stored in a local file, with the path supplied by supplying the argument with the
_FILE suffix. See here (/docs/providers/acme/r/certificate.html#using-variable-files-for-provider-arguments)
for more information.
SELECTEL_TTL - The TTL of the TXT record used for the DNS challenge.
(https://www.hashicorp.com)
NOTE: The following documentation is auto-generated from the ACME provider's API library lego (https://go-
acme.github.io/lego/). Some sections may refer to lego directly - in most cases, these sections apply to the
Terraform provider as well.
For complete information on how to use this provider with the acme_certifiate resource, see here
(/docs/providers/acme/r/certificate.html#using-dns-challenges).
Example
dns_challenge {
provider = "stackpath"
}
}
Argument Reference
The following arguments can be either passed as environment variables, or directly through the config block in
the dns_challenge (/docs/providers/acme/r/certificate.html#dns_challenge) argument in the
acme_certificate (/docs/providers/acme/r/certificate.html) resource. For more details, see here
(/docs/providers/acme/r/certificate.html#using-dns-challenges).
In addition, arguments can also be stored in a local file, with the path supplied by supplying the argument with the
_FILE suffix. See here (/docs/providers/acme/r/certificate.html#using-variable-files-for-provider-arguments)
for more information.
STACKPATH_TTL - The TTL of the TXT record used for the DNS challenge.
(https://www.hashicorp.com)
NOTE: The following documentation is auto-generated from the ACME provider's API library lego (https://go-
acme.github.io/lego/). Some sections may refer to lego directly - in most cases, these sections apply to the
Terraform provider as well.
For complete information on how to use this provider with the acme_certifiate resource, see here
(/docs/providers/acme/r/certificate.html#using-dns-challenges).
Example
dns_challenge {
provider = "transip"
}
}
Argument Reference
The following arguments can be either passed as environment variables, or directly through the config block in
the dns_challenge (/docs/providers/acme/r/certificate.html#dns_challenge) argument in the
acme_certificate (/docs/providers/acme/r/certificate.html) resource. For more details, see here
(/docs/providers/acme/r/certificate.html#using-dns-challenges).
In addition, arguments can also be stored in a local file, with the path supplied by supplying the argument with the
_FILE suffix. See here (/docs/providers/acme/r/certificate.html#using-variable-files-for-provider-arguments)
for more information.
NOTE: The following documentation is auto-generated from the ACME provider's API library lego (https://go-
acme.github.io/lego/). Some sections may refer to lego directly - in most cases, these sections apply to the
Terraform provider as well.
For complete information on how to use this provider with the acme_certifiate resource, see here
(/docs/providers/acme/r/certificate.html#using-dns-challenges).
Example
dns_challenge {
provider = "vegadns"
}
}
Argument Reference
The following arguments can be either passed as environment variables, or directly through the config block in
the dns_challenge (/docs/providers/acme/r/certificate.html#dns_challenge) argument in the
acme_certificate (/docs/providers/acme/r/certificate.html) resource. For more details, see here
(/docs/providers/acme/r/certificate.html#using-dns-challenges).
In addition, arguments can also be stored in a local file, with the path supplied by supplying the argument with the
_FILE suffix. See here (/docs/providers/acme/r/certificate.html#using-variable-files-for-provider-arguments)
for more information.
VEGADNS_TTL - The TTL of the TXT record used for the DNS challenge.
(https://www.hashicorp.com)
NOTE: The following documentation is auto-generated from the ACME provider's API library lego (https://go-
acme.github.io/lego/). Some sections may refer to lego directly - in most cases, these sections apply to the
Terraform provider as well.
For complete information on how to use this provider with the acme_certifiate resource, see here
(/docs/providers/acme/r/certificate.html#using-dns-challenges).
Example
dns_challenge {
provider = "versio"
}
}
Argument Reference
The following arguments can be either passed as environment variables, or directly through the config block in
the dns_challenge (/docs/providers/acme/r/certificate.html#dns_challenge) argument in the
acme_certificate (/docs/providers/acme/r/certificate.html) resource. For more details, see here
(/docs/providers/acme/r/certificate.html#using-dns-challenges).
In addition, arguments can also be stored in a local file, with the path supplied by supplying the argument with the
_FILE suffix. See here (/docs/providers/acme/r/certificate.html#using-variable-files-for-provider-arguments)
for more information.
VERSIO_TTL - The TTL of the TXT record used for the DNS challenge.
NOTE: The following documentation is auto-generated from the ACME provider's API library lego (https://go-
acme.github.io/lego/). Some sections may refer to lego directly - in most cases, these sections apply to the
Terraform provider as well.
For complete information on how to use this provider with the acme_certifiate resource, see here
(/docs/providers/acme/r/certificate.html#using-dns-challenges).
Example
dns_challenge {
provider = "vscale"
}
}
Argument Reference
The following arguments can be either passed as environment variables, or directly through the config block in
the dns_challenge (/docs/providers/acme/r/certificate.html#dns_challenge) argument in the
acme_certificate (/docs/providers/acme/r/certificate.html) resource. For more details, see here
(/docs/providers/acme/r/certificate.html#using-dns-challenges).
In addition, arguments can also be stored in a local file, with the path supplied by supplying the argument with the
_FILE suffix. See here (/docs/providers/acme/r/certificate.html#using-variable-files-for-provider-arguments)
for more information.
VSCALE_TTL - The TTL of the TXT record used for the DNS challenge.
(https://www.hashicorp.com)
NOTE: The following documentation is auto-generated from the ACME provider's API library lego (https://go-
acme.github.io/lego/). Some sections may refer to lego directly - in most cases, these sections apply to the
Terraform provider as well.
For complete information on how to use this provider with the acme_certifiate resource, see here
(/docs/providers/acme/r/certificate.html#using-dns-challenges).
Example
dns_challenge {
provider = "vultr"
}
}
Argument Reference
The following arguments can be either passed as environment variables, or directly through the config block in
the dns_challenge (/docs/providers/acme/r/certificate.html#dns_challenge) argument in the
acme_certificate (/docs/providers/acme/r/certificate.html) resource. For more details, see here
(/docs/providers/acme/r/certificate.html#using-dns-challenges).
In addition, arguments can also be stored in a local file, with the path supplied by supplying the argument with the
_FILE suffix. See here (/docs/providers/acme/r/certificate.html#using-variable-files-for-provider-arguments)
for more information.
NOTE: The following documentation is auto-generated from the ACME provider's API library lego (https://go-
acme.github.io/lego/). Some sections may refer to lego directly - in most cases, these sections apply to the
Terraform provider as well.
For complete information on how to use this provider with the acme_certifiate resource, see here
(/docs/providers/acme/r/certificate.html#using-dns-challenges).
Example
dns_challenge {
provider = "zoneee"
}
}
Argument Reference
The following arguments can be either passed as environment variables, or directly through the config block in
the dns_challenge (/docs/providers/acme/r/certificate.html#dns_challenge) argument in the
acme_certificate (/docs/providers/acme/r/certificate.html) resource. For more details, see here
(/docs/providers/acme/r/certificate.html#using-dns-challenges).
In addition, arguments can also be stored in a local file, with the path supplied by supplying the argument with the
_FILE suffix. See here (/docs/providers/acme/r/certificate.html#using-variable-files-for-provider-arguments)
for more information.
ZONEEE_TTL - The TTL of the TXT record used for the DNS challenge.
(https://www.hashicorp.com)
acme_certificate
The acme_certificate resource can be used to create and manage an ACME TLS certificate.
NOTE: As the usage model of Terraform generally sees it as being run on a different server than a certificate
would normally be placed on, the acme_certificate resource only supports DNS challenges.
Example
The below example is the same example that can be found on the index page
(/docs/providers/acme/index.html), and creates both an account and certificate within the same configuration.
The account is created using the acme_registration (/docs/providers/acme/r/registration.html) resource.
NOTE: When creating accounts and certificates within the same configuration, ensure that you reference the
account_key_pem (/docs/providers/acme/r/registration.html#account_key_pem) argument in the
acme_registration (/docs/providers/acme/r/registration.html) resource as the corresponding
account_key_pem argument in the acme_certificate resource. This will ensure that the account gets created
before the certificate and avoid errors.
provider "acme" {
server_url = "https://acme-staging-v02.api.letsencrypt.org/directory"
}
dns_challenge {
provider = "route53"
}
}
Using an external CSR
The acme_certificate resource can also take an external CSR. In this example, we create one using
tls_cert_request (/docs/providers/tls/r/cert_request.html) first, before supplying it to the
certificate_request_pem argument.
NOTE: Some current ACME CA implementations (including Let's Encrypt) strip most of the organization
information out of a certificate request subject. You may wish to confirm with the CA what behavior to expect
when using the certificate_request_pem argument with this resource.
NOTE: It is not a good practice to use the same private key for both your account and your certificate. Make
sure you use different keys.
provider "acme" {
server_url = "https://acme-staging-v02.api.letsencrypt.org/directory"
}
subject {
common_name = "www.example.com"
}
}
dns_challenge {
provider = "route53"
}
}
Argument Reference
The resource takes the following arguments:
NOTE: All arguments in acme_certificate , other than min_days_remaining , force a new resource when
changed.
account_key_pem (Required) - The private key of the account that is requesting the certificate.
common_name - The certificate's common name, the primary domain that the certificate will be recognized for.
Required when not specifying a CSR.
subject_alternative_names - The certificate's subject alternative names, domains that this certificate will
also be recognized for. Only valid when not specifying a CSR.
key_type - The key type for the certificate's private key. Can be one of: P256 and P384 (for ECDSA keys of
respective length) or 2048 , 4096 , and 8192 (for RSA keys of respective length). Required when not
specifying a CSR. The default is 2048 (RSA key of 2048 bits).
recursive_nameservers (Optional) - The recursive nameservers that will be used to check for propagation of
the challenge record. Defaults to your system-configured DNS resolvers.
NOTE: OCSP stapling requires specific webserver configuration to support the downloading of the staple from
the CA's OCSP endpoints, and should be configured to tolerate prolonged outages of the OCSP service.
Consider this when using must_staple , and only enable it if you are sure your webserver or service provider
can be configured correctly.
min_days_remaining (Optional) - The minimum amount of days remaining on the expiration of a certificate
before a renewal is attempted. The default is 30 . A value of less than 0 means that the certificate will never
be renewed.
certificate_p12_password - (Optional) Password to be used when generating the PFX file stored in
certificate_p12 . Defaults to an empty string.
The ACME provider responds to DNS challenges automatically by utilizing one of the supported DNS challenge
providers. Most providers take credentials as environment variables, but if you would rather use configuration for
this purpose, you can by specifying config blocks within a dns_challenge block, along with the provider
parameter.
dns_challenge {
provider = "route53"
config = {
AWS_ACCESS_KEY_ID = "${var.aws_access_key}"
AWS_SECRET_ACCESS_KEY = "${var.aws_secret_key}"
AWS_DEFAULT_REGION = "us-east-1"
}
}
Most provider arguments can be suffixed with _FILE to specify that you wish to store that value in a local file. This
can be useful if local storage for these values is desired over configuration as variables or within the environment.
dns_challenge {
provider = "route53"
config = {
AWS_ACCESS_KEY_ID_FILE = "/data/secrets/aws_access_key_id"
AWS_SECRET_ACCESS_KEY_FILE = "/data/secrets/aws_secret_access_key"
AWS_DEFAULT_REGION = "us-east-1"
}
}
The ACME provider will normally use your system-configured DNS resolvers to check for propagation of the TXT
records before proceeding with the certificate request. In split horizon scenarios, this check may never succeed, as
the machine running Terraform may not have visibility into these public DNS records.
To override this default behavior, supply the recursive_nameservers to use as a list in host:port form within the
dns_challenge block:
recursive_nameservers = ["8.8.8.8:53"]
dns_challenge {
provider = "route53"
}
The ACME provider will allow you to configure multiple DNS challenges in the event that you have more than one
primary DNS provider.
resource "acme_certificate" "certificate" {
dns_challenge {
provider = "azure"
}
dns_challenge {
provider = "gcloud"
}
dns_challenge {
provider = "route53"
}
You cannot use more than one provider of the same type at once.
Your NS records must be correctly configured so that each DNS challenge provider can correctly discover the
appropriate zone to update.
DNS propagation checks are conducted once per configured common name and subject alternative name,
using the highest configured or default propagation timeout ( *_PROPAGATION_TIMEOUT ) and polling interval
( *_POLLING_INTERVAL ) settings.
The DNS provider configuration specified in the acme_certificate resource is separate from any that you supply
in a corresponding provider whose functionality overlaps with the certificate's DNS providers. This ensures that
there are no hard dependencies between any of these providers and the ACME provider, but it is important to note
so that configuration is supplied correctly.
As an example, if you specify manual configuration for the AWS provider (/docs/providers/aws/index.html) via the
provider (/docs/configuration/providers.html) block instead of the environment, you will still need to supply the
configuration explicitly as per above.
Some of these providers have environment variable settings that overlap with the ones found here, generally
depending on whether or not these variables are supported by the corresponding provider's SDK.
Check the DNS provider page (/docs/providers/acme/dns_providers/index.html) of a specific provider for more
details on exactly what variables are supported.
Certificate renewal
The acme_certificate resource handles automatic certificate renewal so long as a plan or apply is done within the
number of days specified in the min_days_remaining resource parameter. During refresh, if Terraform detects that
the certificate is within the expiry range specified in min_days_remaining , or is already expired, Terraform will mark
the certificate to be renewed on the next apply.
Note that a value less than 0 supplied to min_days_remaining will cause renewal checks to be bypassed, and the
certificate will never renew.
Attribute Reference
certificate_url - The full URL of the certificate within the ACME CA. Same as id .
private_key_pem - The certificate's private key, in PEM format, if the certificate was generated from scratch
and not with certificate_request_pem . If certificate_request_pem was used, this will be blank.
certificate_pem - The certificate in PEM format. This does not include the issuer_pem . This certificate can
be concatenated with issuer_pem to form a full chain.
certificate_p12 - The certificate, intermediate, and the private key archived as a PFX file (PKCS12 format,
generally used by Microsoft products). The data is base64 encoded (including padding), and its password is
configurable via the certificate_p12_password argument. This field is empty if creating a certificate from a
CSR.
(https://www.hashicorp.com)
acme_registration
The acme_registration resource can be used to create and manage accounts on an ACME server. Once
registered, the same private key that has been used for registration can be used to request authorizations for
certificates.
This resource is named acme_registration for historical reasons - in the ACME v1 spec, a registration referred
to the account entity. This resource name is stable and more than likely will not change until a later major
version of the provider, if at all.
Keep in mind that when using this resource along with acme_certificate
(/docs/providers/acme/r/certificate.html) within the same configuration, a change in the provider-level
server_url (example: from the Let's Encrypt staging to production environment) within the same Terraform
state will result in a resource failure, as Terraform will attempt to look for the account in the wrong CA. Consider
different workspaces per environment, and/or using multiple provider instances
(/docs/configuration/providers.html#multiple-provider-instances).
Example
The following creates an account off of a private key generated with the tls_private_key
(/docs/providers/tls/r/private_key.html) resource.
provider "acme" {
server_url = "https://acme-staging-v02.api.letsencrypt.org/directory"
}
Argument Reference
Attribute Reference
id and registration_url will usually be the same and will usually only diverge when migrating protocols, ie:
ACME v1 to v2.