Wildcard

This Driver generates a new subdomain for a domain. It is intended for used with a wildcard DNS record.

Property Description
Resource type dns
Account type None

Inputs

Values

Name Type Description
domain string The domain under which to specify the subdomainFor example, staging.example.com
template string [Optional] A Go Template which should render to a valid DNS Name.

Secrets

None

Notes

There must be a wildcard DNS Record configured for the domain name specified in domain. The record should point to the appropriate Load Balancer.

Template

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.

Example

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}}"
    }
  }
}'
Top