Repository: opentofu/opentofu
File: internal/configs/config_build.go (Go)

Code before:
			req := ModuleRequest{
				Name:              run.Name,
				Path:              path,
				SourceAddr:        run.Module.Source,
				SourceAddrRange:   run.Module.SourceDeclRange,
				VersionConstraint: run.Module.Version,
				Parent:            root,
				Call: NewStaticModuleCall(path, func(v *Variable) (cty.Value, hcl.Diagnostics) {
					// Handle the case where this is overridden in the test run block
					expr, isOverridden := run.Variables[v.Name]
					if isOverridden {
						identifier := StaticIdentifier{
							Module:    path,
							Subject:   fmt.Sprintf("var.%s", v.Name),
							DeclRange: expr.Range(),
						}
						return root.Module.StaticEvaluator.Evaluate(ctx, expr, identifier)
					}

					// If we haven't had it overridden in a run block, fall back to trying our best
					// but we do have defaults for some that we can use.
					if v.Default != cty.NilVal {
						return v.Default, nil
					}
					return cty.DynamicVal, nil
				}, root.Module.SourceDir, ""), // what should the workspace be here? im so confused...

				CallRange: run.Module.DeclRange,
			}

			cfg, modDiags := loadModule(ctx, root, &req, walker)
			diags = append(diags, modDiags...)

			if cfg != nil {
				// To get the loader to work, we need to set a bunch of values
				// (like the name, path, and parent) as if the module was being
				// loaded as a child of the root config.
				//
				// In actuality, when this is executed it will be as if the
				// module was the root. So, we'll post-process some things to
				// get it to behave as expected later.

				// First, update the main module for this test run to behave as
				// if it is the root module.
				cfg.Parent = nil

				// Then we need to update the paths for this config and all
				// children, so they think they are all relative to the root
				// module we just created.
				rebaseChildModule(cfg, cfg)


Review comment (suggestion):
```suggestion
				}, root.Module.SourceDir, root.Module.StaticEvaluator.call.workspace),
```

As far as I can tell, this should be the workspace that is configured for the current run. That is [given to the root module call](https://github.com/opentofu/opentofu/blob/c4f49afc10060ceaaba3ac7367557afcf75f061d/internal/command/meta_config.go#L125) creation and later used to [resolve references like `tofu.workspace`](https://github.com/opentofu/opentofu/blob/c4f49afc10060ceaaba3ac7367557afcf75f061d/internal/configs/static_scope.go#L223).

So it should be available in this context too IINW 🤔 

Code after:
				Name:              run.Name,
				Path:              path,
				SourceAddr:        run.Module.Source,
				SourceAddrRange:   run.Module.SourceDeclRange,
				VersionConstraint: run.Module.Version,
				Parent:            root,
				Call: NewStaticModuleCall(path, func(v *Variable) (cty.Value, hcl.Diagnostics) {
					// Handle the case where this is overridden in the test run block
					expr, isOverridden := run.Variables[v.Name]
					if isOverridden {
						identifier := StaticIdentifier{
							Module:    path,
							Subject:   fmt.Sprintf("var.%s", v.Name),
							DeclRange: expr.Range(),
						}
						return root.Module.StaticEvaluator.Evaluate(ctx, expr, identifier)
					}

					// If we haven't had it overridden in a run block, fall back to trying our best
					// but we do have defaults for some that we can use.
					if v.Default != cty.NilVal {
						return v.Default, nil
					}
					return cty.DynamicVal, nil
				}, root.Module.SourceDir, root.Module.StaticEvaluator.call.workspace),

				CallRange: run.Module.DeclRange,
			}

			cfg, modDiags := loadModule(ctx, root, &req, walker)
			diags = append(diags, modDiags...)

			if cfg != nil {
				// To get the loader to work, we need to set a bunch of values
				// (like the name, path, and parent) as if the module was being
				// loaded as a child of the root config.
				//
				// In actuality, when this is executed it will be as if the
				// module was the root. So, we'll post-process some things to
				// get it to behave as expected later.

				// First, update the main module for this test run to behave as
				// if it is the root module.
				cfg.Parent = nil

				// Then we need to update the paths for this config and all
				// children, so they think they are all relative to the root
				// module we just created.
				rebaseChildModule(cfg, cfg)

				// Finally, link the new config back into our test run so