Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add Git environment variables to example templates
  • Loading branch information
dwahler committed Jul 18, 2022
commit 2e1415a2e0350c43daf33db596c47ed1d06552f9
6 changes: 6 additions & 0 deletions examples/templates/aws-linux/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ resource "coder_agent" "dev" {
arch = "amd64"
auth = "aws-instance-identity"
os = "linux"
env = {
GIT_AUTHOR_NAME = "${data.coder_workspace.me.owner_name}"
GIT_COMMITTER_NAME = "${data.coder_workspace.me.owner_name}"
GIT_AUTHOR_EMAIL = "${data.coder_workspace.me.owner_email}"
GIT_COMMITTER_EMAIL = "${data.coder_workspace.me.owner_email}"
}
}

locals {
Expand Down
6 changes: 6 additions & 0 deletions examples/templates/aws-windows/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@ resource "coder_agent" "dev" {
arch = "amd64"
auth = "aws-instance-identity"
os = "windows"
env = {
GIT_AUTHOR_NAME = "${data.coder_workspace.me.owner_name}"
GIT_COMMITTER_NAME = "${data.coder_workspace.me.owner_name}"
GIT_AUTHOR_EMAIL = "${data.coder_workspace.me.owner_email}"
GIT_COMMITTER_EMAIL = "${data.coder_workspace.me.owner_email}"
}
}

locals {
Expand Down
6 changes: 6 additions & 0 deletions examples/templates/do-linux/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,12 @@ data "coder_workspace" "me" {}
resource "coder_agent" "dev" {
os = "linux"
arch = "amd64"
env = {
GIT_AUTHOR_NAME = "${data.coder_workspace.me.owner_name}"
GIT_COMMITTER_NAME = "${data.coder_workspace.me.owner_name}"
GIT_AUTHOR_EMAIL = "${data.coder_workspace.me.owner_email}"
GIT_COMMITTER_EMAIL = "${data.coder_workspace.me.owner_email}"
}
}

resource "digitalocean_volume" "home_volume" {
Expand Down
6 changes: 6 additions & 0 deletions examples/templates/docker-code-server/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ resource "coder_agent" "dev" {
arch = var.docker_arch
os = "linux"
startup_script = "code-server --auth none"
env = {
GIT_AUTHOR_NAME = "${data.coder_workspace.me.owner_name}"
GIT_COMMITTER_NAME = "${data.coder_workspace.me.owner_name}"
GIT_AUTHOR_EMAIL = "${data.coder_workspace.me.owner_email}"
GIT_COMMITTER_EMAIL = "${data.coder_workspace.me.owner_email}"
}
}

resource "coder_app" "code-server" {
Expand Down
8 changes: 7 additions & 1 deletion examples/templates/docker-image-builds/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ data "coder_workspace" "me" {
resource "coder_agent" "dev" {
arch = var.step2_arch
os = "linux"
env = {
GIT_AUTHOR_NAME = "${data.coder_workspace.me.owner_name}"
GIT_COMMITTER_NAME = "${data.coder_workspace.me.owner_name}"
GIT_AUTHOR_EMAIL = "${data.coder_workspace.me.owner_email}"
GIT_COMMITTER_EMAIL = "${data.coder_workspace.me.owner_email}"
}
}

variable "docker_image" {
Expand Down Expand Up @@ -107,7 +113,7 @@ resource "docker_container" "workspace" {
# Hostname makes the shell more user friendly: coder@my-workspace:~$
hostname = lower(data.coder_workspace.me.name)
dns = ["1.1.1.1"]
# Use the docker gateway if the access URL is 127.0.0.1
# Use the docker gateway if the access URL is 127.0.0.1
command = ["sh", "-c", replace(coder_agent.dev.init_script, "127.0.0.1", "host.docker.internal")]
env = ["CODER_AGENT_TOKEN=${coder_agent.dev.token}"]
host {
Expand Down
6 changes: 6 additions & 0 deletions examples/templates/docker/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,12 @@ resource "coder_agent" "dev" {
curl -fsSL https://code-server.dev/install.sh | sh
code-server --auth none --port 13337
EOF
env = {
GIT_AUTHOR_NAME = "${data.coder_workspace.me.owner_name}"
GIT_COMMITTER_NAME = "${data.coder_workspace.me.owner_name}"
GIT_AUTHOR_EMAIL = "${data.coder_workspace.me.owner_email}"
GIT_COMMITTER_EMAIL = "${data.coder_workspace.me.owner_email}"
}
}

resource "coder_app" "code-server" {
Expand Down
6 changes: 6 additions & 0 deletions examples/templates/gcp-linux/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ resource "coder_agent" "dev" {
auth = "google-instance-identity"
arch = "amd64"
os = "linux"
env = {
GIT_AUTHOR_NAME = "${data.coder_workspace.me.owner_name}"
GIT_COMMITTER_NAME = "${data.coder_workspace.me.owner_name}"
GIT_AUTHOR_EMAIL = "${data.coder_workspace.me.owner_email}"
GIT_COMMITTER_EMAIL = "${data.coder_workspace.me.owner_email}"
}
}

resource "google_compute_instance" "dev" {
Expand Down
6 changes: 6 additions & 0 deletions examples/templates/gcp-vm-container/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ resource "coder_agent" "dev" {
auth = "google-instance-identity"
arch = "amd64"
os = "linux"
env = {
GIT_AUTHOR_NAME = "${data.coder_workspace.me.owner_name}"
GIT_COMMITTER_NAME = "${data.coder_workspace.me.owner_name}"
GIT_AUTHOR_EMAIL = "${data.coder_workspace.me.owner_email}"
GIT_COMMITTER_EMAIL = "${data.coder_workspace.me.owner_email}"
}
}

module "gce-container" {
Expand Down
6 changes: 6 additions & 0 deletions examples/templates/gcp-windows/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ resource "coder_agent" "dev" {
auth = "google-instance-identity"
arch = "amd64"
os = "windows"
env = {
GIT_AUTHOR_NAME = "${data.coder_workspace.me.owner_name}"
GIT_COMMITTER_NAME = "${data.coder_workspace.me.owner_name}"
GIT_AUTHOR_EMAIL = "${data.coder_workspace.me.owner_email}"
GIT_COMMITTER_EMAIL = "${data.coder_workspace.me.owner_email}"
}
}

resource "google_compute_instance" "dev" {
Expand Down
18 changes: 18 additions & 0 deletions examples/templates/kubernetes-multi-service/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,34 @@ data "coder_workspace" "me" {}
resource "coder_agent" "go" {
os = "linux"
arch = "amd64"
env = {
GIT_AUTHOR_NAME = "${data.coder_workspace.me.owner_name}"
GIT_COMMITTER_NAME = "${data.coder_workspace.me.owner_name}"
GIT_AUTHOR_EMAIL = "${data.coder_workspace.me.owner_email}"
GIT_COMMITTER_EMAIL = "${data.coder_workspace.me.owner_email}"
}
}

resource "coder_agent" "java" {
os = "linux"
arch = "amd64"
env = {
GIT_AUTHOR_NAME = "${data.coder_workspace.me.owner_name}"
GIT_COMMITTER_NAME = "${data.coder_workspace.me.owner_name}"
GIT_AUTHOR_EMAIL = "${data.coder_workspace.me.owner_email}"
GIT_COMMITTER_EMAIL = "${data.coder_workspace.me.owner_email}"
}
}

resource "coder_agent" "ubuntu" {
os = "linux"
arch = "amd64"
env = {
GIT_AUTHOR_NAME = "${data.coder_workspace.me.owner_name}"
GIT_COMMITTER_NAME = "${data.coder_workspace.me.owner_name}"
GIT_AUTHOR_EMAIL = "${data.coder_workspace.me.owner_email}"
GIT_COMMITTER_EMAIL = "${data.coder_workspace.me.owner_email}"
}
}

resource "kubernetes_pod" "main" {
Expand Down