Pass git configuration variables via terraform#3034
Conversation
|
Updated to no longer pass an |
examples/templates/do-linux/main.tf
Outdated
| env = { | ||
| GIT_AUTHOR_NAME = "${data.coder_workspace.me.owner}" | ||
| GIT_COMMITTER_NAME = "${data.coder_workspace.me.owner}" | ||
| GIT_AUTHOR_EMAIL = "${data.coder_workspace.me.owner_email}" | ||
| GIT_COMMITTER_EMAIL = "${data.coder_workspace.me.owner_email}" | ||
| } |
There was a problem hiding this comment.
I think we should add this to our docs (which you can do in this PR too), but we shouldn't do it in all templates. I think it could give the perception that this is mandatory when it certainly isn't.
There was a problem hiding this comment.
Makes sense. In that case I'd lean towards including it in the docker and docker-code-server templates, since those are the ones that are most likely to be used for a "quickstart", and removing it from the others. I'll add documentation as well.
There was a problem hiding this comment.
I agree with that. Makes sense to me!
jsjoeio
left a comment
There was a problem hiding this comment.
This seems like a really nice UX improvement - thanks for adding to the docker-code-server template too! 🎉
mafredri
left a comment
There was a problem hiding this comment.
This turned out really nice!
docs/templates.md
Outdated
| for more information. | ||
|
|
||
| For example, the [Docker quick-start template](https://github.com/coder/coder/tree/main/examples/templates/docker) | ||
| sets a few environment variables based on the username and email address of the user's owner, so |
There was a problem hiding this comment.
| sets a few environment variables based on the username and email address of the user's owner, so | |
| sets a few environment variables based on the username and email address of the workspace's owner, so |
docs/templates.md
Outdated
| } | ||
| ``` | ||
|
|
||
| You can add these variable definitions to your own templates, or customize them however you like. |
There was a problem hiding this comment.
| You can add these variable definitions to your own templates, or customize them however you like. | |
| You can add these environment variable definitions to your own templates, or customize them however you like. |
| startup_script = "code-server --auth none" | ||
|
|
||
| # These environment variables allow you to make Git commits right away after creating a | ||
| # workspace. Note that they take precedence over configuration defined in ~/.gitconfig! |
There was a problem hiding this comment.
❤️ For calling out this behavior!
This PR removes the hard-coded agent functionality that sets
GIT_*environment variables automatically. Instead, we pass the username and email address of the workspace owner to the Terraform provisioner, so that users can explicitly configure this behavior with theenvblock of thecoder_agentresource:I've also added this configuration to the
dockeranddocker-code-serverexample templates.Depends on the corresponding provider change in coder/terraform-provider-coder#31 to add the new
owner_emaildata source attribute.Fixes #2665, obsoletes #2980, obsoletes #2981