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.
This commit is contained in:
Martin Atkins 2017-05-30 16:05:17 -07:00
parent 5f9f13ab8f
commit d4e5abe0eb
1 changed files with 6 additions and 2 deletions

View File

@ -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 {