Open
Description
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:
resource "aws_lambda_function" "this" {
...
environment {
variables = var.environment.variables
}
...
}
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 that sam 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:
- Have a lambda within a module with environment variables supplied as a
map(string)
type variable to the module. sam build; sam local invoke xyz --env-vars env.json
- The environment variables needed won't work here.
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)
{
"version": "1.95.0",
"system": {
"python": "3.8.13",
"os": "macOS-13.4.1-arm64-arm-64bit"
},
"additional_dependencies": {
"docker_engine": "24.0.2",
"aws_cdk": "Not available",
"terraform": "1.4.6"
},
"available_beta_feature_env_vars": [
"SAM_CLI_BETA_FEATURES",
"SAM_CLI_BETA_BUILD_PERFORMANCE",
"SAM_CLI_BETA_TERRAFORM_SUPPORT",
"SAM_CLI_BETA_RUST_CARGO_LAMBDA"
]
}