From d4e5abe0eb343879b0d8053eb626dae055aea676 Mon Sep 17 00:00:00 2001 From: Martin Atkins Date: Tue, 30 May 2017 16:05:17 -0700 Subject: [PATCH] core: terraform.env variable is now terraform.workspace As part of our terminology shift, the interpolation variable for the name of the current workspace changes to terraform.workspace. The old name continues to be supported for compatibility. We can't generate a deprecation warning from here so for now we'll just silently accept terraform.env as an alias, but not mention it at all in the error message in the hope that its use phases out over time before we actually remove it. --- terraform/interpolate.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/terraform/interpolate.go b/terraform/interpolate.go index 0def295fa9..22ddce6c83 100644 --- a/terraform/interpolate.go +++ b/terraform/interpolate.go @@ -317,9 +317,13 @@ func (i *Interpolater) valueTerraformVar( n string, v *config.TerraformVariable, result map[string]ast.Variable) error { - if v.Field != "env" { + + // "env" is supported for backward compatibility, but it's deprecated and + // so we won't advertise it as being allowed in the error message. It will + // be removed in a future version of Terraform. + if v.Field != "workspace" && v.Field != "env" { return fmt.Errorf( - "%s: only supported key for 'terraform.X' interpolations is 'env'", n) + "%s: only supported key for 'terraform.X' interpolations is 'workspace'", n) } if i.Meta == nil {