Skip to content

Commit 09e06e3

Browse files
committed
chore: update lima example to use --with-terraform arg
1 parent bbe33fe commit 09e06e3

File tree

1 file changed

+17
-18
lines changed

1 file changed

+17
-18
lines changed

examples/lima/coder.yaml

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -65,25 +65,16 @@ provision:
6565
# See: https://github.com/lima-vm/lima/issues/528
6666
chown ${LIMA_CIDATA_USER} /var/run/docker.sock
6767
chmod og+rwx /var/run/docker.sock
68-
- mode: system
69-
script: |
70-
#!/bin/bash
71-
set -eux -o pipefail
72-
command -v terraform >/dev/null 2>&1 && exit 0
73-
DEBIAN_FRONTEND=noninteractive apt-get install -qqy unzip
74-
rm -fv /tmp/terraform.zip || true
75-
wget -qO /tmp/terraform.zip "https://releases.hashicorp.com/terraform/1.3.0/terraform_1.3.0_linux_$(dpkg --print-architecture).zip"
76-
unzip /tmp/terraform.zip -d /usr/local/bin/
77-
chmod +x /usr/local/bin/terraform
78-
rm -fv /tmp/terraform.zip || true
7968
- mode: system
8069
script: |
8170
#!/bin/bash
8271
set -eux -o pipefail
8372
command -v coder >/dev/null 2>&1 && exit 0
8473
export DEBIAN_FRONTEND=noninteractive
8574
export HOME=/root
86-
curl -fsSL https://coder.com/install.sh | sh
75+
# Install some dependencies
76+
apt-get install -qqy unzip
77+
curl -fsSL https://coder.com/install.sh | sh -s -- --with-terraform
8778
# Ensure Coder has permissions on /var/run/docker.socket
8879
usermod -aG docker coder
8980
# Ensure coder listens on all interfaces
@@ -93,10 +84,8 @@ provision:
9384
# Ensure coder starts on boot
9485
systemctl enable coder
9586
systemctl start coder
96-
# Wait for Coder to have downloaded Terraform
97-
timeout 60s bash -c 'until /var/cache/coder/terraform version >/dev/null 2>&1; do sleep 1; done'
98-
# Coder restarts after downloading Terraform, wait for it to become available
99-
timeout 60s bash -c 'until nc -z localhost 3000 > /dev/null 2>&1; do sleep 1; done'
87+
# Wait for Terraform to be installed
88+
timeout 60s bash -c 'until /usr/local/bin/terraform version >/dev/null 2>&1; do sleep 1; done'
10089
- mode: user
10190
script: |
10291
#!/bin/bash
@@ -137,14 +126,24 @@ probes:
137126
fi
138127
hint: |
139128
See "/var/log/cloud-init-output.log" in the guest.
129+
- description: "terraform to be installed"
130+
script: |
131+
#!/bin/bash
132+
set -eux -o pipefail
133+
if ! timeout 30s bash -c "until command -v terraform >/dev/null 2>&1; do sleep 3; done"; then
134+
echo >&2 "terraform is not installed yet"
135+
exit 1
136+
fi
137+
hint: |
138+
See "/var/log/cloud-init-output.log" in the guest.
140139
message: |
141140
All Done! Your Coder instance is accessible at http://localhost:3000
142141
143142
Username: "admin@coder.com"
144-
Password: Run `LIMA_INSTANCE=coder lima cat /home/${USER}.linux/.config/coderv2/password` 🤫
143+
Password: Run `LIMA_INSTANCE={{.Instance.Name}} lima cat /home/${USER}.linux/.config/coderv2/password` 🤫
145144
146145
Get started creating your own template now:
147146
------
148-
limactl shell coder
147+
limactl shell {{.Instance.Name}}
149148
cd && coder templates init
150149
------

0 commit comments

Comments
 (0)