apprunner-roadmap icon indicating copy to clipboard operation
apprunner-roadmap copied to clipboard

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

Open Leonelmarianog opened this issue 1 year ago • 4 comments

Community Note

  • Please vote on this issue by adding a 👍 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

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!.

Leonelmarianog avatar Jan 15 '24 15:01 Leonelmarianog

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

PrBart avatar Feb 08 '24 19:02 PrBart

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.

sxalexander avatar Feb 21 '24 21:02 sxalexander

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.

benlavalley avatar Feb 28 '24 19:02 benlavalley

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

atali avatar Feb 28 '24 19:02 atali