I’m just thinking out loud here. I think overwhelming majority of the time, when we invoke these:
we can safely assume that we want them from CURRENT_ORG and CURRENT_WORKSPACE. so, when those params are omitted, perhaps TFC can add this default behavior. I’m talking about remote run in TFC / TFE, not OSS one.
Unless there’s already a function that has the same effect? if so, could anyone point me to the right direction?
Hi, welcome to the forum!
Terraform Cloud has a number of variables available to source the sort of info you’re looking for, documented here: Terraform Cloud's Run Environment - Runs - Terraform Cloud | Terraform | HashiCorp Developer
I’m not sure of the specifics of your situation, but I should also note that…
- Output variables are the interface to other workspaces’ data, so you shouldn’t need to source output values from the current workspace. If you’re wanting to read other workspaces’ output values, that
tfe_outputs data source is the way to do it though, yup!
- Variable values of the current workspace are another thing you don’t need to source explicitly yourself - they’re given to the current workspace’s run already (both as Terraform input variables and Unix environment variables). Most of the time you probably don’t need to source variable values from other workspaces, either - you’d want to source whatever data from the output values the workspace provides (your situation may be different, of course!)