-
-
Notifications
You must be signed in to change notification settings - Fork 540
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
feat: Add support for set env vars inside hook runtime #408
Conversation
@@ -60,6 +64,11 @@ function common::parse_cmdline { | |||
TF_INIT_ARGS+=("$1") | |||
shift | |||
;; | |||
-e | --envs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@antonbabenko Any ideas on how it can be better named?
Main idea:
You can specify environment variables that will be passed to the hook runtime.
Config example for now
- id: terraform_validate
args:
- --envs=AWS_DEFAULT_REGION="us-west-2"
- --envs=AWS_ACCESS_KEY_ID="anaccesskey"
- --envs=AWS_SECRET_ACCESS_KEY="asecretkey"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yermulnik proposed --env-vars
, but I don't think that much better option, to introduce it and then remove --envs
in 2.0.0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
env-vars sounds perfect to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Style comments/suggestions may be considered (or not) later and in scope of another PR.
- --envs=AWS_DEFAULT_REGION="us-west-2" | ||
- --envs=AWS_ACCESS_KEY_ID="anaccesskey" | ||
- --envs=AWS_SECRET_ACCESS_KEY="asecretkey" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed privately we'll get back to reconsidering this option's name later (e.g. to --env-vars
or something like that)
Co-authored-by: George L. Yermulnik <yz@yz.kiev.ua>
# [1.74.0](v1.73.0...v1.74.0) (2022-07-12) ### Bug Fixes * Add `--env-vars`, deprecate `--envs` ([#410](#410)) ([2b35cad](2b35cad)) * Add `--tf-init-args`, deprecate `--init-args` ([#407](#407)) ([c4f8251](c4f8251)) ### Features * Add support for set env vars inside hook runtime ([#408](#408)) ([d490231](d490231)) * Allow `terraform_providers_lock` specify terraform init args ([#406](#406)) ([32b232f](32b232f)) * Suppress color for all hooks if `PRE_COMMIT_COLOR=never` set ([#409](#409)) ([b12f0c6](b12f0c6))
Put an
x
into the box if that apply: