Appsettings.json and Secrets.json in Pulumi. What ...
# dotnet
b
Appsettings.json and Secrets.json in Pulumi. What are the best practices for using
appsettings.json
and
secrets.json
in C# Pulumi projects? My scenario is that I want to use a connection string for a resource on a completely different resource group. not controlled by pulumi as an application setting for my azure app service. I want to store the value of this connection string in
secrets.json
like I would for any typicaly .net application. The only docs I can find is this https://www.pulumi.com/blog/7-ways-to-deal-with-application-secrets-in-azure/#2-configuration-files but this simply says "_With some configuration not shown here, the properties are filled at startup_", but it is the stuff that is not shown that I would love to see.
g
I believe the part that says With some configuration not shown here... is referencing the fact that you'd need to load the configuration(s) yourself through something like:
Copy code
new ConfigurationBuilder
  .AddJsonFile("appSettings.json", true, true)
  .Build();
You'd then be able to load the configuration details into a POCO, where the rest of your app is free to use it.
w
Yes, you should wire up config as you would outside of Pulumi.
This really comes together when using the dotnet automation api, then you can bypass pulumi config altogether, and just use dotnet config sources. https://github.com/gitfool/Pulumi.Dungeon/blob/master/Cli/HostBuilderExtensions.cs#L20 You would have something similar and wire up
AddUserSecrets
config source.
👍 1