DNS Wildcard
Reference for the humanitec/dns-wildcard driver
This driver generates a new subdomain for a domain. It is intended for used with a wildcard DNS record.
Property | Description |
---|---|
Resource Type | |
Account Type | None |
Name | Type | Description |
---|---|---|
domain | string | The domain under which to specify the subdomain. E.g. staging.example.com |
template | string |
None
There must be a wildcard DNS Record configured for the domain name specified in
domain
. The record should point to the appropriate Load Balancer.The template string is evaluated as a Go Template. The Sprig library of template functions is also available. Note that the template string does not need to include any Go template structures. For example, the context placeholders can be used on their own to create friendly subdomains. For example:
${context.env.id}-${context.app.id}
will generate a subdomain made up of the Environment ID and the Application ID.
Care must be taken to avoid name conflicts. Humanitec will not validate whether all the DNS names in an environment are unique or not. Having duplicate DNS names can, in some cases, cause ingress errors.
In this example, we use the
humanitec/dns-wildcard
driver to provision new subdomains under staging.hosted-domain.com
for an app called dns-example-app
. The subdomain will include the name of the app and a random alphanumeric string.Then following Dynamic Resource Definition should be added:
curl https://api.humanitec.io/orgs/my-org/resources/defs \
-X POST \
-H "Authorization: Bearer $HUMANITEC_TOKEN" \
-H "Content-Type: application/json" \
--data-binary '{
"id": "dynamic-dns",
"name": "Dynamic DNS",
"type": "dns",
"criteria": [
{
"app_id": "dns-example-app"
}
],
"driver_type": "humanitec/dns-wildcard",
"driver_inputs": {
"values": {
"domain": "staging.hosted-domain.com",
"template": "${context.app.id}-{{ randAlphaNum 4 | lower}}"
},
"secrets": {
"tls": {
"tls.crt": "-----BEGIN CERTIFICATE-----\n...\n-----END CERTIFICATE-----\n",
"tls.key": "-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n"
}
}
}
}'
Last modified 11mo ago