From 60017822e07beb6669cfd0fbded1ba7e5d096e23 Mon Sep 17 00:00:00 2001 From: sylviamoss Date: Mon, 22 Feb 2021 16:19:55 +0100 Subject: [PATCH] add docs --- .../content/docs/commands/hcl2_upgrade.mdx | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/website/content/docs/commands/hcl2_upgrade.mdx b/website/content/docs/commands/hcl2_upgrade.mdx index d6a5b44e6..3c7652eec 100644 --- a/website/content/docs/commands/hcl2_upgrade.mdx +++ b/website/content/docs/commands/hcl2_upgrade.mdx @@ -51,6 +51,57 @@ locals { } ``` +## Upgrading variables file + +From **v1.7.1**, the `hcl2_upgrade` command can upgrade a variables file. + + + + +```json +{ + "variables": { + "aws_region": null, + "aws_secondary_region": "{{ env `AWS_DEFAULT_REGION` }}", + "aws_secret_key": "", + "aws_access_key": "", + }, + "sensitive-variables": [ + "aws_secret_key", + "aws_access_key", + ] +} +``` + + + + +```hcl +variable "aws_access_key" { + type = string + default = "" + sensitive = true +} + +variable "aws_region" { + type = string +} + +variable "aws_secondary_region" { + type = string + default = "${env("AWS_DEFAULT_REGION")}" +} + +variable "aws_secret_key" { + type = string + default = "" + sensitive = true +} +``` + + + + ## Go template functions `hcl2_upgrade` will do its best to transform your go _template calls_ to HCL2,