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
Next Next commit
fix: update agent ID in example templates
  • Loading branch information
johnstcn committed Jul 26, 2022
commit f541c1b9c1728937084d57478220f9b835225b85
2 changes: 1 addition & 1 deletion examples/templates/aws-linux/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="userdata.txt"

#!/bin/bash
sudo -u ${local.linux_user} sh -c '${coder_agent.dev.init_script}'
sudo -u ${local.linux_user} sh -c '${coder_agent.main.init_script}'
--//--
EOT

Expand Down
2 changes: 1 addition & 1 deletion examples/templates/aws-windows/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ locals {
user_data_start = <<EOT
<powershell>
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
${coder_agent.dev.init_script}
${coder_agent.main.init_script}
</powershell>
<persist>true</persist>
EOT
Expand Down
6 changes: 3 additions & 3 deletions examples/templates/bare/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ terraform {
data "coder_workspace" "me" {
}

resource "coder_agent" "dev1" {
resource "coder_agent" "main" {
os = "linux"
arch = "amd64"
auth = "token"
Expand All @@ -32,8 +32,8 @@ resource "null_resource" "fake-compute" {
# Run the Coder agent init script on resources
# to access web apps and SSH:
#
# export CODER_AGENT_TOKEN=${coder_agent.dev1.token}
# ${coder_agent.dev1.init_script}
# export CODER_AGENT_TOKEN=${coder_agent.main.token}
# ${coder_agent.main.init_script}
}

resource "null_resource" "fake-disk" {
Expand Down
4 changes: 2 additions & 2 deletions examples/templates/do-linux/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ resource "digitalocean_droplet" "workspace" {
user_data = templatefile("cloud-config.yaml.tftpl", {
username = data.coder_workspace.me.owner
home_volume_label = digitalocean_volume.home_volume.initial_filesystem_label
init_script = base64encode(coder_agent.dev.init_script)
coder_agent_token = coder_agent.dev.token
init_script = base64encode(coder_agent.main.init_script)
coder_agent_token = coder_agent.main.token
})
# Required to provision Fedora.
ssh_keys = var.step2_do_admin_ssh_key > 0 ? [var.step2_do_admin_ssh_key] : []
Expand Down
6 changes: 3 additions & 3 deletions examples/templates/docker-code-server/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ resource "coder_agent" "main" {
}

resource "coder_app" "code-server" {
agent_id = coder_agent.dev.id
agent_id = coder_agent.main.id
url = "http://localhost:8080/?folder=/home/coder"
icon = "/icon/code.svg"
}
Expand All @@ -70,8 +70,8 @@ resource "docker_container" "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
entrypoint = ["sh", "-c", replace(coder_agent.dev.init_script, "127.0.0.1", "host.docker.internal")]
env = ["CODER_AGENT_TOKEN=${coder_agent.dev.token}"]
entrypoint = ["sh", "-c", replace(coder_agent.main.init_script, "127.0.0.1", "host.docker.internal")]
env = ["CODER_AGENT_TOKEN=${coder_agent.main.token}"]
host {
host = "host.docker.internal"
ip = "host-gateway"
Expand Down
4 changes: 2 additions & 2 deletions examples/templates/docker-image-builds/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ resource "docker_container" "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
command = ["sh", "-c", replace(coder_agent.dev.init_script, "127.0.0.1", "host.docker.internal")]
env = ["CODER_AGENT_TOKEN=${coder_agent.dev.token}"]
command = ["sh", "-c", replace(coder_agent.main.init_script, "127.0.0.1", "host.docker.internal")]
env = ["CODER_AGENT_TOKEN=${coder_agent.main.token}"]
host {
host = "host.docker.internal"
ip = "host-gateway"
Expand Down
4 changes: 2 additions & 2 deletions examples/templates/docker-with-dotfiles/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ resource "docker_container" "workspace" {
name = "coder-${data.coder_workspace.me.owner}-${lower(data.coder_workspace.me.name)}"
dns = ["1.1.1.1"]
# Refer to Docker host when Coder is on localhost
command = ["sh", "-c", replace(coder_agent.dev.init_script, "127.0.0.1", "host.docker.internal")]
env = ["CODER_AGENT_TOKEN=${coder_agent.dev.token}"]
command = ["sh", "-c", replace(coder_agent.main.init_script, "127.0.0.1", "host.docker.internal")]
env = ["CODER_AGENT_TOKEN=${coder_agent.main.token}"]
host {
host = "host.docker.internal"
ip = "host-gateway"
Expand Down
6 changes: 3 additions & 3 deletions examples/templates/docker/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ resource "coder_agent" "main" {
}

resource "coder_app" "code-server" {
agent_id = coder_agent.dev.id
agent_id = coder_agent.main.id
name = "code-server"
url = "http://localhost:13337/?folder=/home/coder"
icon = "/icon/code.svg"
Expand Down Expand Up @@ -124,10 +124,10 @@ resource "docker_container" "workspace" {
"sh", "-c",
<<EOT
trap '[ $? -ne 0 ] && echo === Agent script exited with non-zero code. Sleeping infinitely to preserve logs... && sleep infinity' EXIT
${replace(coder_agent.dev.init_script, "localhost", "host.docker.internal")}
${replace(coder_agent.main.init_script, "localhost", "host.docker.internal")}
EOT
]
env = ["CODER_AGENT_TOKEN=${coder_agent.dev.token}"]
env = ["CODER_AGENT_TOKEN=${coder_agent.main.token}"]
host {
host = "host.docker.internal"
ip = "host-gateway"
Expand Down
2 changes: 1 addition & 1 deletion examples/templates/gcp-linux/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ set -eux pipefail

mkdir /root || true
cat <<'EOCODER' > /root/coder_agent.sh
${coder_agent.dev.init_script}
${coder_agent.main.init_script}
EOCODER
chmod +x /root/coder_agent.sh

Expand Down
4 changes: 2 additions & 2 deletions examples/templates/gcp-vm-container/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ module "gce-container" {
container = {
image = "mcr.microsoft.com/vscode/devcontainers/go:1"
command = ["sh"]
args = ["-c", coder_agent.dev.init_script]
args = ["-c", coder_agent.main.init_script]
securityContext = {
privileged : true
}
Expand Down Expand Up @@ -85,6 +85,6 @@ resource "google_compute_instance" "dev" {

resource "coder_agent_instance" "dev" {
count = data.coder_workspace.me.start_count
agent_id = coder_agent.dev.id
agent_id = coder_agent.main.id
instance_id = google_compute_instance.dev[0].instance_id
}
2 changes: 1 addition & 1 deletion examples/templates/gcp-windows/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ resource "google_compute_instance" "dev" {
scopes = ["cloud-platform"]
}
metadata = {
windows-startup-script-ps1 = coder_agent.dev.init_script
windows-startup-script-ps1 = coder_agent.main.init_script
serial-port-enable = "TRUE"
}
}