Closed pdang29 closed 1 year ago
The use case for extra_env_vars
is for merging extra environment variables on top of the default ones if you need to do so. You would add these in your {env}.tfvars
file like so:
extra_env_vars = [
{
name = "MY_ENV_VAR"
value = "my-value"
}
]
If you want to add sensitive data that should not be committed to code, there are a few options:
aws-secretsmanager-caching
which is maintained by AWSextra_env_vars
to add a value that you can safely commit to the .tfvars
file like I have shown above.vars
files. I assume you are not using my Terraform modules directly but instead are using your own modules. Then you can change them as you need to support adding extra environment variables through environment secrets. You would also need to update the GitHub Actions scripts to inject the TF_VARS_
env vars to the step that runs terraform plan/apply
Let me know if you have any other questions about these suggestions, hope that helps!
Thanks for the suggestions, I was able to get it to work using secret manager. Thanks again!
I tried to pass Github secrets to terraform using TF_VAR_variable_name, then use as an environment variable for Gunicorn task, but so far it has not been successful. I saw in your terraform-aws-django modules/prod/app module "api" there is a variable called extra_env_vars. What is the use case for this? Can we actually use this variable to pass secrets from Github?
I would appreciate if you have any suggestions on how to pass extra environment variables to django.
Thanks!