Update hcl2upgrade command to update env calls + tests (#10244)

This commit is contained in:
Adrien Delorme 2020-11-11 20:54:22 +01:00 committed by GitHub
parent 1a08bf8ce9
commit f44e912072
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 1 deletions

View File

@ -322,7 +322,7 @@ func transposeTemplatingCalls(s []byte) []byte {
return fmt.Sprintf("${var.%s}", in)
},
"env": func(in string) string {
return fmt.Sprintf("${var.%s}", in)
return fmt.Sprintf("${env(%q)}", in)
},
"build": func(a string) string {
return fmt.Sprintf("${build.%s}", a)

View File

@ -30,6 +30,11 @@ variable "aws_region" {
type = string
}
variable "aws_secondary_region" {
type = string
default = "${env("AWS_DEFAULT_REGION")}"
}
variable "aws_secret_key" {
type = string
default = ""

View File

@ -3,6 +3,7 @@
"variables": {
"secret_account": "🤷",
"aws_region": null,
"aws_secondary_region": "{{ env `AWS_DEFAULT_REGION` }}",
"aws_secret_key": "",
"aws_access_key": ""
},