add docs for sensitive variables

This commit is contained in:
Adrien Delorme 2020-10-05 15:27:12 +02:00
parent 10b648b282
commit fcaf766569
4 changed files with 32 additions and 2 deletions

View File

@ -30,6 +30,8 @@ Example of a variable assignment from a file:
`@include 'from-1.5/variables/must-be-set.mdx'`
`@include 'from-1.5/variables/sensitive.mdx'`
# More on variables
- Read the [full variables](/docs/from-1.5/variables) description for a more

View File

@ -356,3 +356,5 @@ other variables: the last value found overrides the previous values.
| `var.bar` in .pkr.hcl file | error, "bar undeclared" | error, "bar undeclared" |
| `-var bar=yz` argument | error, "bar undeclared" | error, "bar undeclared" |
| `export PKR_VAR_bar=yz` | - | - |
`@include 'from-1.5/variables/sensitive.mdx'`

View File

@ -1,8 +1,11 @@
```hcl
# variables.pkr.hcl
variable "foo" {
type = string
default = "the default value of the `foo` variable"
type = string
default = "the default value of the `foo` variable"
description = "description of the `foo` variable"
sensitive = false
# When a variable is sensitive all string-values from that variable will be
# obfuscated from Packer's output.
}
```

View File

@ -0,0 +1,23 @@
## A variable can be sensitive
When a variable is sensitive all string-values from that variable will be
obfuscated from Packer's output :
```hcl
# var-foo.pkr.hcl
variable "foo" {
sensitive = true
default = {
key = "SECR3TP4SSW0RD"
}
}
```
```shell-session
$ packer inspect var-foo.pkr.hcl
Packer Inspect: HCL2 mode
> input-variables:
var.foo: "{\n \"key\" = \"<sensitive>\"\n }"
...
```