aws / apprunner-roadmap

This is the public roadmap for AWS App Runner.
https://aws.amazon.com/apprunner/
Other
298 stars 14 forks source link

Request: Allow to set environment variables for the build stage from the web console. #229

Open Leonelmarianog opened 8 months ago

Leonelmarianog commented 8 months ago

Community Note

Tell us about your request What do you want us to build?

Ability to pass environment variables for the build stage in App Runner directly from the web console.

Use case:

I have 2 App Runner services, one for production and one for stage. Each one of these require specific environment variables for the application to build propertly. I can't use a single apprunner.yml configuration file because there is no way to specify the correct environment variables for each service. Having the ability to pass environment variables in the build stage per service will solve this problem.

image

Describe alternatives you've considered

Allow to set a path to the apprunner.yml file when creating the service as an alternative to it being automatically read by App Runner, that way we could specify where is the file in the repository for each service. For example: apprunner.prod.yml and apprunner.stage.yml.

image

Additional context Anything else we should know?

This is a related issue: https://github.com/aws/apprunner-roadmap/issues/182

Thanks!.

PrBart commented 7 months ago

I spent a whole day figuring out that env vars aren't available during the build. Awesome service, such an enterprise solution.

sxalexander commented 7 months ago

This is critical for cases like many javascript frontends where the build step is responsible for baking environment variables into static file output or bundles, and those bundles don't have access to the env during the run step.

benlavalley commented 7 months ago

I use Nuxt3 I'm trying to move to App Runner from Netlify and it needs environment variables during the build stage. There are some hacks I can use to try and get them injected but they're a bit ugly.

It looks like this issue was moved to the "We are working on it" phase of the roadmap in November of 2022 after it was created on June 7th of 2021 -- nearly 3 years ago.

https://github.com/aws/apprunner-roadmap/issues/48

*edit I did get Nuxt3 reading env variables finally during the run stage, there is a specific syntax they need that is otherwise not required for the build.

atali commented 7 months ago

Yes really annoying, I have to use apprunner.yaml instead of cdk code.... apprunner.yaml support only one environment and I have to manage 3 differents env ( dev, uat and prod). I have to leverage sourceDirectory to make it work. It's really ugly, we really need to support variable environments and ssm parameter at build time