Add documentation

This commit is contained in:
Olivier Ceyral 2018-08-08 17:44:51 +02:00 committed by Megan Marsh
parent a906d1d630
commit 83fce837d8
1 changed files with 20 additions and 0 deletions

View File

@ -95,6 +95,26 @@ single source of input to a template that a user can easily discover using
that is evaluated by shell during a variable expansion. As Packer doesn't run that is evaluated by shell during a variable expansion. As Packer doesn't run
inside a shell, it won't expand `~`. inside a shell, it won't expand `~`.
## Consul keys
Consul keys can be used within your template using the `consul_key` function.
This function is available *only* within the default value of a user variable,
for reasons similar to environment variables above.
```json
{
"variables": {
"soft_versions": "{{ consul_key `my_image/softs_versions/next` }}"
}
}
```
This will default `soft_versions` to the value of the key `my_image/softs_versions/next`
in consul.
The configuration for consul (address, tokens, ...) must be specified as environment variables,
as specified in the [Documentation](https://www.consul.io/docs/commands/index.html#environment-variables).
## Using array values ## Using array values
Some templates call for array values. You can use template variables for these, Some templates call for array values. You can use template variables for these,