-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: Is there a way to supply overrides for non-specified environment variables when using with terraform #5822
Comments
Hello @toddtarsi, |
one question, How do you originally get the value of these variables before you passed them to the module? |
@moelasmar - Thank you for the quick response! (sorry for delay, had to pick up kiddo from preschool) So, I actually build the zip files in another codebase, and then I am using sam build without metadata to generate the template config (I just override filename to point at my other repos dist files, all of that works fine). My template looks like a lot of this:
However, these zip files rely on some specific environment variables during their runtime / execution (PG_HOSTNAME, etc), but because there is some abstraction at the module boundary, these get missed when scraping ENVIRONMENT.
Example samconfig.env.json:
Example samconfig.container.env.json:
Log output when I console.log the env on the running process:
|
@moelasmar - Sorry for second message, should have included this in the first. Basically, I'm trying to supply unspecified environment variables to the running lambda local invocation but I just can't figure out how to get them in there. In a lot of ways, this might not even involve terraform at this stage and I'm probably conflating like 10 different things. Thank you for the help, and sorry for the confusion. |
After looking around, I believe I'm hitting this issue basically: |
Description:
We use the module pattern in terraform, which leads to most resources having a sort of wrapper. As a result, our environment variables are a bit abstracted like this:
The command
sam build
expectedly won't pick up these variables, so they don't get into the generated template.json file, and I think thats fine. The next problem is thatsam local invoke xyz
won't allow me to inject these dynamic environment variables into the runtime. At least,--env-vars
doesn't seem to be able to actually inject environment variables. Is there something I'm missing?Steps to reproduce:
map(string)
type variable to the module.sam build; sam local invoke xyz --env-vars env.json
Observed result:
None of the env vars under Parameters are injected.
Expected result:
I would expect the env-vars under Parameters to be injected as environment variables.
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
The text was updated successfully, but these errors were encountered: