Placeholders

Placeholders in Humanitec

Overview

Sometimes the value of some configuration will change depending on the Environment that a workload is deployed into. For example, you may want your workload to connect to a different database in a development than in a production environment. To allow for this, Humanitec provides placeholders that can be inserted into the variable values.

Syntax

Placeholders are of the form ${...} where the content is a placeholder path. Any number of placeholders can be included in the value of a variable. For example:

Hello ${values.PLACEHOLDER_EXAMPLE}!

Will resolve the shared value PLACEHOLDER_EXAMPLE at deployment time and insert the value into the string above.

A literal ${ can be inserted by escaping the { with a backslash. For example: $\{.

Placeholder Paths

values.

Values resolve to a Shared Value or Secret defined for an App. The resolved value will include any overrides for the environment.

${values.MY_VALUE}

externals.

Every External Resource added as a dependency to a Workload has some data associated with it that is needed to be able to access it. For example, to connect to a database you need to know the host, port, name of database and access credentials.

The structure of the the placeholder path is:

${externals.RESOURCE_ID.DATA_PROPERTY}
  • RESOURCE_ID is the ID specified for the resource in the Workload.

  • DATA_PROPERTY is the data property as defined by the resource being depended on.

modules.

Modules are the internal name for Workloads in Humanitec. This is scheduled to change in 2021.

Modules allow the retrieval of in-cluster data about other workloads. For example, the in-cluster DNS name of the Kubernetes Service for a pod.

The available paths are:

Path

Description

modules.WORKLOAD_ID.service.name

The in-cluster name of the workload.

modules.WORKLOAD_ID.service.public_name

If a public DNS name has been configured for the workload, this is the DNS name.

modules.WORKLOAD_ID.externals

This can be used to access configuration for external resources depended on by other Workloads