37 lines
708 B
Plaintext
37 lines
708 B
Plaintext
# Source Variables
|
|
|
|
It is possible to access the `name` and `type` of your `source` from
|
|
provisioners and post-processors:
|
|
|
|
```hcl
|
|
source "null" "first-example" {
|
|
communicator = "none"
|
|
}
|
|
|
|
build {
|
|
name = "roles"
|
|
|
|
source "null.first-example" {
|
|
name = "consul"
|
|
}
|
|
source "null.first-example" {
|
|
name = "nomad"
|
|
}
|
|
source "null.first-example" {
|
|
name = "vault"
|
|
}
|
|
sources = ["null.first-example"]
|
|
|
|
provisioner "shell-local" {
|
|
inline = ["echo ${source.name} and ${source.type}"]
|
|
}
|
|
}
|
|
|
|
# This will echo something like:
|
|
#
|
|
# roles.null.consul: consul and null
|
|
# roles.null.nomad: nomad and null
|
|
# roles.null.vault: vault and null
|
|
# roles.null.first-example: first-example and null
|
|
```
|