-
Notifications
You must be signed in to change notification settings - Fork 1.1k
feat: set TF_APPEND_USER_AGENT environment variable #5588
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Luke Young <lyoung@confluent.io>
Signed-off-by: Luke Young <lyoung@confluent.io>
Signed-off-by: Luke Young <lyoung@confluent.io>
@nitrocode Any other feedback/concerns on this PR? I'd like to get it merged/address any feedback before it gets eaten by the stale PR robot again like #2688 was 😄 |
Signed-off-by: Luke Young <lyoung@confluent.io>
Co-authored-by: RB <7775707+nitrocode@users.noreply.github.com> Signed-off-by: Luke Young <91491244+lyoung-confluent@users.noreply.github.com>
Thanks @lyoung-confluent for the changes. I added a couple comments |
@nitrocode I finally got a chance to test this, it does NOT work. The environment variable gets set for custom workflows without issue, but a default plan/apply steps do not work, it seems only these environment variables are set for the executed atlantis/server/core/terraform/tfclient/terraform_client.go Lines 432 to 437 in 315e25b
I'm curious what you would suggest as a fix, it seems that I would have to inject the values somewhere around here for it to be present consistently? atlantis/server/events/project_command_runner.go Lines 827 to 834 in 315e25b
|
Signed-off-by: Luke Young <lyoung@confluent.io>
Signed-off-by: Luke Young <lyoung@confluent.io>
Okay, so this diff works (verified using local instance), only problem now is it's not being actually exercised in a test... |
Signed-off-by: Luke Young <lyoung@confluent.io>
what
Many Terraform providers will respect the
TF_APPEND_USER_AGENT
environment variable and append it to the existing provider/terraform user-agent when making HTTP requests.This change sets the value to indicate that Terraform is running within Atlantis and includes the PR URL, head commit SHA and username who triggered the command (NOTE: this is not necessarily the PR author). It is set before custom environment variables so users who have set this manually (ex: #2651) will still have their own value set.
why
It's useful to have this information in logs (ex: CloudTrail) to identify exactly what PR modified a resource.
tests
I added a test for this new variable.
references