https://pulumi.com logo
Title
b

bright-flag-46266

11/14/2022, 2:23 PM
Hi all, I am using C# to configure pulumi and I have a helm chart that I'm trying to deploy where I am trying to configure some users. the configuration in the chart looks as follow
users:
- user: foo
  pass: bar
my C# configuration for doing this looks like the following
"users", new Dictionary<string, object>()
{
    {"user", "foo"},
    {"pass", "bar"}
}
but I am getting the following error from the pod
Expected users field to be an array, got map[pass:0xc000074e10 user:0xc000074e60]
how do I specify an array of values to a helm chart? I have looked at the documentation for Helm Releases but it didn't help much https://www.pulumi.com/registry/packages/kubernetes/api-docs/helm/v3/release/#release
e

echoing-dinner-19531

11/14/2022, 2:53 PM
That
-
makes it a yaml array of one object, so you probably want something like:
"users", new object[] { new { user = "foo", pass = "bar" } }
b

bright-flag-46266

11/14/2022, 3:00 PM
Hi @echoing-dinner-19531 thanks for the suggestion, unfortunately i get the following error when trying your solution
An unhandled exception has occurred while executing the request.
      System.InvalidOperationException: <>f__AnonymousType21`2[[System.String, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea
7798e],[System.String, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]] is not a supported argument type.
I tried something similar to your suggestion myself, but i get a "Not supported argument type" each time i try to specify some type of array
i've tried to use
"users", new InputList<object>()
                                                    {
                                                        (Input<object>) new {user = "foo", pass = "bar"},
                                                    }
in case there were some special handling around lists
e

echoing-dinner-19531

11/14/2022, 3:07 PM
Ah, just checking what is supported here. Looks like if you make a System.Text.JsonElement for the value it would be ok. I think that's something like:
var bytes = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(new { user = "foo", pass = "bar"});
var obj = System.Text.Json.JsonDocument.Parse(bytes).RootElement;
Might be a nicer way of doing that, but that at least should give back a JsonElement to pass in.
w

worried-city-86458

11/29/2022, 3:10 AM
I recommend using anonymous types as much as possible like I do here Note the workaround down the bottom of the code block though, which can be removed if 8013 is ever fixed.
a

ancient-pillow-66484

02/16/2023, 4:05 PM
Is this still an issue to set a property of type Array? I cant get it to work i'm trying to use Dictionary as much as possible
w

worried-city-86458

03/06/2023, 6:28 PM
I haven't had an issue with arrays, just anonymous objects.