You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Any configuration using the remote backend with at least one non-string variable that is set remotely in the Terraform Cloud/Enterprise workspace settings is subject to this limitation.
terraform {
backend"remote" {
# (any valid remote backend configuration referring to# a workspace with a stored value for "example")
}
}
variable"example" {
type=list(string)
}
Expected Behavior
When running a Terraform command that operates only locally, such as terraform import, the remote backend should retrieved the stored variable value and parse it as HCL (due to the HCL checkbox being set) in order to set the value for the variable.
Actual Behavior
The remote backend always interprets all variable values as strings, causing the above to be interpreted as "[\"a\", \"b\"]" instead of as ["a", "b"]. Because there's a type constraint on that variable, the variable value fails validation with an error:
Error: Invalid value for input variable
The environment variable TF_VAR_example does not contain a valid value for
variable "example": list of string required.
It is additionally misreported as being set by environment variable because that is the source type used by the remote backend when populating these variables fetched from the remote workspace.
Steps to Reproduce
With a configuration and remote workspace configuration like the above, run a command like terraform import which attempts to construct a local context for their operation after fetching the variables from the remote workspace.
Additional Context
The relevant code that is assuming all variable values are strings is here:
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
ghost
locked and limited conversation to collaborators
Mar 29, 2020
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Terraform Version
Terraform Configuration
Any configuration using the
remote
backend with at least one non-string variable that is set remotely in the Terraform Cloud/Enterprise workspace settings is subject to this limitation.Expected Behavior
When running a Terraform command that operates only locally, such as
terraform import
, the remote backend should retrieved the stored variable value and parse it as HCL (due to the HCL checkbox being set) in order to set the value for the variable.Actual Behavior
The remote backend always interprets all variable values as strings, causing the above to be interpreted as
"[\"a\", \"b\"]"
instead of as["a", "b"]
. Because there's a type constraint on that variable, the variable value fails validation with an error:It is additionally misreported as being set by environment variable because that is the source type used by the remote backend when populating these variables fetched from the remote workspace.
Steps to Reproduce
With a configuration and remote workspace configuration like the above, run a command like
terraform import
which attempts to construct a local context for their operation after fetching the variables from the remote workspace.Additional Context
The relevant code that is assuming all variable values are strings is here:
terraform/backend/remote/testing.go
Lines 286 to 289 in ce68b4d
The text was updated successfully, but these errors were encountered: