rhythmic-crowd-40243
11/07/2022, 2:02 AM"logWorkspaces": {
"eastus2": "app-logs-eastus2-law16df9848",
"central": "...",
...
}
This my attempt to try and extract the output.
var logWorkspaceReference = coreStackReference
.RequireOutput(App.Infra.Core.OutputNames.LogWorkspace);
var x = logWorkspaceReference.Apply(o => JsonSerializer
.Deserialize<Dictionary<string, object>>(o.ToString()));
var workspace = Pulumi.AzureNative.OperationalInsights.GetWorkspace.Invoke(
new GetWorkspaceInvokeArgs
{
ResourceGroupName = resourceGroup.Location,
WorkspaceName = x.Apply(url => (string) url["eastus2"])
});
But deserialization is failing…
an unhandled exception:
System.Text.Json.JsonException: 'S' is an invalid start of a value. Path: $ | LineNumber: 0 | BytePositionInLine: 0.
at void System.Text.Json.ThrowHelper.ReThrowWithPath(ref ReadStack state, JsonReaderException ex)
I don’t think I’m understanding outputs correctly. But before I spend anymore time on this, can this be done?echoing-dinner-19531
11/07/2022, 9:48 AMrhythmic-crowd-40243
11/07/2022, 12:30 PMechoing-dinner-19531
11/07/2022, 12:41 PMlogWorkspaceReference.Apply(x => (Dictionary<string, object>)x)
, I think structured values are due a pass over making them better at some point though. Like all this is just JSON underneath we should just let RequireOutput set the JSON deserialiser and return the right value there and then.rhythmic-crowd-40243
11/07/2022, 11:46 PMlogWorkspaceReference.Apply(x => (ImmutableDictionary<string, object>)x)
worked. I don’t know why I wasn’t connecting the dots, but I’m moving again. The future state of RequireOutput
sounds great, looking forward to its eventual arrival. Thank you so much @echoing-dinner-19531!