mysterious-australia-14256
07/23/2021, 9:26 AM[Output]
public Output<Pulumi.AzureNative.OperationalInsights.Workspace> LogAnalyticsWorkspace { get; set; }
That seems to go out OK with the results something like
Outputs:
+ LogAnalyticsWorkspace: {
+ URN: "urn:pulumi:<stackname>::<projectname>::azure-native:resources:ResourceGroup$azure-native:operationalinsights:Workspace::<workspacename>"
+ ID : "/subscriptions/<subscriptionid>/resourcegroups/<resourcegroupname>/providers/microsoft.operationalinsights/workspaces/<workspacename>"
+ PackageVersion: ""
}
However when I try create a stack reference in the second project with the following code I get an error
var coreStackReference = new StackReference("coreStackReference", new StackReferenceArgs
{
Name = "<stackname>",
});
The error is
invocation of pulumi:pulumi:getResource returned an error: unknown resource urn:pulumi:<stackname>::<projectname>::azure-native:resources:ResourceGroup$azure-native:operationalinsights:Workspace::<workspacename>
Is it incorrect to try and pass objects in this way? I don't seem to get the errors when just passing strings so do I need to just pass IDs rather than objects and then rehydrate them somehow?brave-planet-10645
07/23/2021, 9:39 AMvar other = new StackReference("<stackname>");
var otherOutput = other.GetOutput("x");
mysterious-australia-14256
07/23/2021, 9:54 AM[Output]
public Output<Pulumi.AzureNative.OperationalInsights.Workspace> LogAnalyticsWorkspace { get; set; }
I am using
this.LogAnalyticsWorkspace = Pulumi.Output.Create(workspace);
Does that look correct?brave-planet-10645
07/23/2021, 9:56 AMGetWorkspace
method in the second project to get the values you need. https://www.pulumi.com/docs/reference/pkg/azure-native/operationalinsights/getworkspace/mysterious-australia-14256
07/23/2021, 9:57 AMvar 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?brave-planet-10645
07/23/2021, 10:38 AM