diff --git a/website/pages/docs/from-1.5/blocks/variable.mdx b/website/pages/docs/from-1.5/blocks/variable.mdx index 16bf86f0f..e7af7093a 100644 --- a/website/pages/docs/from-1.5/blocks/variable.mdx +++ b/website/pages/docs/from-1.5/blocks/variable.mdx @@ -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 diff --git a/website/pages/docs/from-1.5/variables.mdx b/website/pages/docs/from-1.5/variables.mdx index 934f87447..1cd2eb260 100644 --- a/website/pages/docs/from-1.5/variables.mdx +++ b/website/pages/docs/from-1.5/variables.mdx @@ -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'` diff --git a/website/pages/partials/from-1.5/variables/foo-block.mdx b/website/pages/partials/from-1.5/variables/foo-block.mdx index 63cb2351d..5b68c1c08 100644 --- a/website/pages/partials/from-1.5/variables/foo-block.mdx +++ b/website/pages/partials/from-1.5/variables/foo-block.mdx @@ -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. } ``` diff --git a/website/pages/partials/from-1.5/variables/sensitive.mdx b/website/pages/partials/from-1.5/variables/sensitive.mdx new file mode 100644 index 000000000..bc5ec3066 --- /dev/null +++ b/website/pages/partials/from-1.5/variables/sensitive.mdx @@ -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\" = \"\"\n }" +... +```