Skip to content

Instantly share code, notes, and snippets.

@jeffa
Created June 30, 2024 13:34
Show Gist options
  • Save jeffa/2dc7fa1933e5a0e99345dbfc08b46b21 to your computer and use it in GitHub Desktop.
Save jeffa/2dc7fa1933e5a0e99345dbfc08b46b21 to your computer and use it in GitHub Desktop.
Configures a provisioned VM with terraform
#!/bin/sh
# prevent interactive prompts
sudo sed -i "/#\$nrconf{restart} = 'i';/s/.*/\$nrconf{restart} = 'a';/" \
/etc/needrestart/needrestart.conf
cat /etc/needrestart/needrestart.conf | grep -i nrconf{restart}
sudo apt-get update && sudo apt-get install -y gnupg software-properties-common
wget -O- https://apt.releases.hashicorp.com/gpg | gpg --dearmor | sudo tee /usr/share/keyrings/hashicorp-archive-keyring.gpg > /dev/null
echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] \
https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list
sudo apt update
sudo apt-get install terraform
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment