I'm working with an ASP.NET Core app that utilizes appsettings.json for its default values, which we then override using environment variables for different environments. Our Terraform deployment sets up over 30 environment variables at the app service level, and keeping track of these is becoming a bit overwhelming since environment variables lack the structure that YAML or JSON provides. Unlike Kubernetes, where we can use structured configmaps and mount them as files, we're limited with App Service to using just environment variables.
I've been considering a few options:
1. Have Terraform pull structured YAML or JSON from our config repo, then map it to a flat list of environment variables. This would certainly make the config easier to maintain in the repo, but we'll still have to deal with a long list of flat env vars in Terraform plans and App Service configurations.
2. Use Azure App Configuration to store our JSON config. However, I'm not convinced this offers much difference in terms of management.
3. During the deployment pipeline, we could mount appsettings.json from our config repo directly to the app service.
I'm leaning towards option 1 for the short term and considering option 3 for the long term, but that may require some testing and adjustments to our deployment pipeline. What are your thoughts?
3 Answers
Why are you keeping such a hefty configuration outside of your main repo? I'd be curious to understand what drives that decision.
I usually opt for the first option when dealing with repeatable values in Terraform. It works great! Just a tip—don’t store secret values directly in there. Instead, you can reference Key Vault secret IDs in those JSON files, which can be integrated into your Terraform code as locals. This keeps your configuration clean and secure.
In my previous company, we had a separate config repo that contained a large JSON file with all our static info. This was called from the Terraform source repo. It sounds a lot like what you propose in option 1—it could definitely be a solid approach.
Related Questions
How To: Running Codex CLI on Windows with Azure OpenAI
Set Wordpress Featured Image Using Javascript
How To Fix PHP Random Being The Same
Why no WebP Support with Wordpress
Replace Wordpress Cron With Linux Cron
Customize Yoast Canonical URL Programmatically