Thanks to visit codestin.com
Credit goes to github.com

Skip to content

chore: update lima example to use --with-terraform arg #5655

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

Merged
merged 2 commits into from
Jan 10, 2023

Conversation

johnstcn
Copy link
Member

#5586 added the capability for install.sh to download and install Terraform automatically. Using this now in the example Lima specification.
Also no longer hard-coding the instance name in favour of {{.Instance.Name}} in the output that gets emitted upon successful instance provisioning.

@johnstcn johnstcn requested review from mafredri and mtojek January 10, 2023 15:56
@johnstcn johnstcn self-assigned this Jan 10, 2023
Comment on lines -68 to -78
- mode: system
script: |
#!/bin/bash
set -eux -o pipefail
command -v terraform >/dev/null 2>&1 && exit 0
DEBIAN_FRONTEND=noninteractive apt-get install -qqy unzip
rm -fv /tmp/terraform.zip || true
wget -qO /tmp/terraform.zip "https://releases.hashicorp.com/terraform/1.3.0/terraform_1.3.0_linux_$(dpkg --print-architecture).zip"
unzip /tmp/terraform.zip -d /usr/local/bin/
chmod +x /usr/local/bin/terraform
rm -fv /tmp/terraform.zip || true
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

review: no longer required

Comment on lines 75 to 76
# Install some dependencies
apt-get install -qqy unzip
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

review: required for --with-terraform

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Maybe leave a comment in the code

Comment on lines +87 to +88
# Wait for Terraform to be installed
timeout 60s bash -c 'until /usr/local/bin/terraform version >/dev/null 2>&1; do sleep 1; done'
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

review: terraform path updated

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is no longer required at all, right? It should be installed by the time install.sh finishes.

Copy link
Member Author

@johnstcn johnstcn Jan 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My thinking here is that if terraform installation fails for some reason, it will be more obvious to the end-user.

Edit: thinking more about it, any errors with Terraform installation should show up in the cloud-init log and be surfaced by install.sh, so this probably doesn't add much value.

message: |
All Done! Your Coder instance is accessible at http://localhost:3000

Username: "[email protected]"
Password: Run `LIMA_INSTANCE=coder lima cat /home/${USER}.linux/.config/coderv2/password` 🤫
Password: Run `LIMA_INSTANCE={{.Instance.Name}} lima cat /home/${USER}.linux/.config/coderv2/password` 🤫
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

@mafredri mafredri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! 👍🏻

Comment on lines +87 to +88
# Wait for Terraform to be installed
timeout 60s bash -c 'until /usr/local/bin/terraform version >/dev/null 2>&1; do sleep 1; done'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is no longer required at all, right? It should be installed by the time install.sh finishes.

Comment on lines 75 to 76
# Install some dependencies
apt-get install -qqy unzip
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Maybe leave a comment in the code

@johnstcn johnstcn merged commit 19ae42a into main Jan 10, 2023
@johnstcn johnstcn deleted the cj/lima-example-with-terraform-arg branch January 10, 2023 17:25
@github-actions github-actions bot locked and limited conversation to collaborators Jan 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants