This message was deleted.
# dotnet
s
This message was deleted.
b
Copy code
var other = new StackReference("<stackname>");
var otherOutput = other.GetOutput("x");
m
Thanks @brave-planet-10645. I am still getting the same error using the above syntax though. In the top level project I am creating my workspace and storing it in a variable called workspace (type Pulumi.AzureNative.OperationalInsights.Workspace). In order to pass this to
Copy code
[Output]
public Output<Pulumi.AzureNative.OperationalInsights.Workspace> LogAnalyticsWorkspace { get; set; }
I am using
Copy code
this.LogAnalyticsWorkspace = Pulumi.Output.Create(workspace);
Does that look correct?
b
I think that's because you're passing a resource between stacks. You can't do that. I suggest passing the name of the resource, and then using the
GetWorkspace
method in the second project to get the values you need. https://www.pulumi.com/docs/reference/pkg/azure-native/operationalinsights/getworkspace/
m
OK thanks
@brave-planet-10645 OK I think I'm making progress. I can pass across the names happily now. I am passing the resourceGroupName and the workspaceName as the getWorkspace function seems to need both. They get read into the second project as types Output<string> so I can't pass them to getWorkspace directly as it only accepts strings. I can work around this with some ugly code like
Copy code
var ws = Pulumi.Output.Tuple(resourceGroupName, workspaceName).Apply(names =>
{
	return Pulumi.AzureNative.OperationalInsights.GetWorkspace.InvokeAsync(new Pulumi.AzureNative.OperationalInsights.GetWorkspaceArgs
	{
		ResourceGroupName = names.Item1,
		WorkspaceName = names.Item2
     });
});
Am I overcomplicating things with the above or is that the only way? That still only returns me an Output<GetWorkspaceResult> so I assume I would then need to use something like Pulumi.AzureNative.OperationalInsights.Workspace.Get to get at the actual workspace. If so then I guess I can just pass IDs between projects and skip the getWorkspace piece altogether and just use Workspace.Get...? Am I missing something or does that look like the basic process?
b
if you just need the IDs, just have the IDs as outputs