terraform-provider-azurerm icon indicating copy to clipboard operation
terraform-provider-azurerm copied to clipboard

Support for Setting Environment Variables in Startup Command for Azure Web App

Open levitin opened this issue 1 year ago • 2 comments
trafficstars

Is there an existing issue for this?

  • [X] I have searched the existing issues

Community Note

  • Please vote on this issue by adding a :thumbsup: reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment and review the contribution guide to help.

Description

I am trying to set environment variables in the startup command for an Azure App Service using azurerm_linux_web_app. Specifically, I want to configure a Docker container with an environment variable in the startup command to trigger a maven profile.

Expected Behavior

The expected behavior is that the startup command should be able to set environment variables for Docker, similar to the following:

docker run -d --expose=8080 -e VARIABLE=false mydomain.azurecr.io/image-name:latest 

Actual Behavior Currently, it seems that the startup command does not support setting environment variables in this manner. As a result, I'm unable to configure my container to use specific environment variables.

New or Affected Resource(s)/Data Source(s)

azurerm_linux_web_app

Setting Environment Variable over Portal

webapp

Potential Terraform Configuration

No response

References

No response

levitin avatar Apr 29 '24 16:04 levitin

Would love to see this as well, maybe in the site_config section :)

alainkaiser avatar Sep 11 '24 14:09 alainkaiser

app_settings does this:

resource "azurerm_linux_web_app" "app_service" {
  ...
  app_settings = {
    "BEST_SEA_CREATURE" = "octopus"
  }
}
import os
best = os.environ.get("BEST_SEA_CREATURE")

bdc avatar Oct 17 '24 17:10 bdc