Use Placeholders in Provisioning
You can use placeholders for configuration item (CI) properties that will be replaced with values during provisioning. Use this to create provisioning packages that are environment-independent and reusable. For more information, see Provisioning through Deploy.
The placeholder values can be provided:
- By dictionaries
- By the user who sets up a provisioning
- From provisioneds that are assigned to the target provisioned environment
Placeholder formats
The Deploy provisioning feature recognizes placeholders using the following formats:
Placeholder type | Format |
---|---|
Property placeholders | {{ PLACEHOLDER_KEY }} |
Contextual placeholders | {{% PLACEHOLDER_KEY %}} |
Literal placeholders | {{' PLACEHOLDER_KEY '}} |
Property placeholders
With property placeholders, you can configure the properties of CIs in a provisioning package. Deploy scans provisioning packages and searches the CIs for placeholders. The properties of the following items are scanned:
- Bound templates on provisioning packages
- Bound templates on provisionables (items in provisioning packages)
- Provisioners on provisionables
- Provisioning packages
Before you can provision a package to a target provisioning environment, you must provide values for all property placeholders. You can provide values using different methods:
- In a dictionary that is assigned to the environment
- In the provisioning properties when you set up the provisioning in the GUI
- With the
placeholders
parameter in the command-line interface (CLI)
Contextual placeholders
Contextual placeholders serve the same purpose as property placeholders. The values for contextual placeholders are not known before the provisioning plan is executed. Example: A provisioning step might require the public IP address of the instance that is created during provisioning. This value is only available after the instance is actually created and Deploy has fetched its public IP address.
Deploy resolves contextual placeholders when executing a provider or when finalizing the provisioning plan.
Contextual properties are resolved from properties on the provisioneds they are linked to. The placeholder name must exactly match the provisioned property name (it is case-sensitive).
Example: The contextual placeholders for the public host name and IP address of an aws.ec2.Instance
CI are {{% publicHostname %}}
and {{% publicIp %}}
.
If the value of placeholder is not resolved, the resolution of templates that contain the placeholder will fail.
Literal placeholders
You can insert literal placeholders in a dictionary that should only be resolved when a deployment package is deployed to the created environment. The resolution of these placeholders does not depend on provisioned, dictionary, or a manual user entry.
Example: The value {{'XYZ'}}
will resolve to {{XYZ}}
.