https://pulumi.com logo
#general
Title
# general
m

mammoth-night-22453

05/27/2020, 8:14 PM
Trying to reference nested configuration objects directly, and not having much luck. I'm using C#. For example, given the following configuration:
Copy code
config:
  proj:data:
    nonProductionStart: 10.1.0.0
    productionStart: 10.2.0.0
    stacks:
    - name: Sandbox
      peerConnectionName: peerConnectionId
      stackName: org/Sandbox/mono
I can indeed follow the docs and get a JsonElement first, then get the sub-element as a string using something like
Copy code
var data = Configuration.GetObject<JsonElement>("data");
var stacksAsString = data.GetProperty("stacks");
But what I really am trying to do is something like:
Copy code
var stacks = Configuration.GetObject<List<StackReferenceInfo>>("data.stacks");
But, this does not appear to work. Is there no way to achieve this without jumping through the JsonElement hoop? I have reviewed https://www.pulumi.com/docs/intro/concepts/config/#structured-configuration and it shows the JsonElement method - perhaps that's the only way?