-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
all shells: Pass env vars through a key value store (#11569)
* allowing to set shell env vars from a key/value map. * tests This new map will work alongside the `environment_vars` but it allows using a datasource value seamlessly. At validation, and because `environment_vars` was an array of strings containing `KEY=value`, using datsources would not work, because these values are not known yet and would evaluate to `<unknown>`. With this, the value and the key can be unknown and will validate correctly for datasources.
- Loading branch information
Showing
14 changed files
with
95 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
|
||
data "null" "secret" { | ||
input = "s3cr3t" | ||
} | ||
|
||
locals { | ||
secret = data.null.secret.output | ||
} | ||
|
||
source "file" "foo" { | ||
content = "foo" | ||
target = "foo.txt" | ||
} | ||
|
||
build { | ||
sources = ["file.foo"] | ||
provisioner "shell-local" { | ||
only_on = ["darwin", "freebsd", "linux", "openbsd", "solaris"] | ||
# original bug in : | ||
# environment_vars = ["MY_SECRET=${local.secret}"] | ||
env = { | ||
"MY_SECRET":"${local.secret}", | ||
} | ||
inline = [ | ||
"echo yo, my secret is $MY_SECRET", | ||
"echo '' > $MY_SECRET", | ||
] | ||
} | ||
provisioner "shell-local" { | ||
only_on = ["windows"] | ||
env = { | ||
"MY_SECRET":"${local.secret}", | ||
} | ||
inline = [ | ||
"echo yo, my secret is %MY_SECRET%", | ||
"echo '' > %MY_SECRET%", | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters