tall-needle-56640
12/07/2020, 11:37 PMPulumi.Azure
, I did this:
args.AppSettings = InputMap<string>.Merge(defaultAppSettings, args.AppSettings);
Now I'm trying to migrate that code to AzureNextGen
, but I'm not sure how to get it to work. I tried:
var appSettings = args.SiteConfig.Apply(c => c.AppSettings);
args.SiteConfig.Apply(s =>
s.AppSettings = InputMap<string>.Merge(defaultAppSettings, appSettings));
But I get an error:
Argument 2: cannot convert from 'Pulumi.Output<Pulumi.InputList<Pulumi.AzureNextGen.Web.Latest.Inputs.NameValuePairArgs>>' to 'Pulumi.InputMap<string>'So what do I do to make this work? Note
defaultAppSettings
is of type Dictionary<string, string>
.Input
and Output
casts, I can't accomplish what should be easily achievable.tall-librarian-49374
12/08/2020, 9:16 PMvar merged = args.SiteConfig
.Apply(c => c.AppSettings.ToOutput())
.Apply(settings =>
Output.All(settings.Select(s => Output.Tuple(s.Name, s.Value))))
.Apply(settings =>
{
var dict = new Dictionary<string, string>(defaultAppSettings);
foreach (var (k, v) in settings)
dict[k] = v;
return dict.Select(kv => new NameValuePairArgs {Name = kv.Key, Value = kv.Value});
});
args.SiteConfig.Apply(s => s.AppSettings = merged);
tall-needle-56640
12/10/2020, 4:16 PMInput
/ Output
is pretty slick. But man can it be annoying at the same time. 🙂var value = "someValue";
Input<T> inputValue = value;
var newValue = inputValue.Value;
Assert.Equal(value, newValue);
Maybe Input<T>.Value
is only non-null if it was implicitly cast from type T
class Input<T>
{
public T? Value;
public static implicit operator Input<T>([MaybeNull]T value)
{
Value = value;
return Output.Create(value);
}
}
tall-librarian-49374
12/10/2020, 8:44 PM