This commit is contained in:
sylviamoss 2021-02-22 16:19:55 +01:00
parent 2016d6baec
commit 60017822e0
1 changed files with 51 additions and 0 deletions

View File

@ -51,6 +51,57 @@ locals {
}
```
## Upgrading variables file
From **v1.7.1**, the `hcl2_upgrade` command can upgrade a variables file.
<Tabs>
<Tab heading="Original file (variables.json)">
```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",
]
}
```
</Tab>
<Tab heading="Result file (variables.pkr.hcl)">
```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
}
```
</Tab>
</Tabs>
## Go template functions
`hcl2_upgrade` will do its best to transform your go _template calls_ to HCL2,