Created
September 18, 2024 08:53
-
-
Save rajivmehtaflex/ad4b89a1a0692cef1824b2053ab6516a to your computer and use it in GitHub Desktop.
terraform installation script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# install_terraform.sh | |
# Exit immediately if a command exits with a non-zero status | |
set -e | |
# Update the package index | |
echo "Updating package index..." | |
sudo apt-get update | |
# Install required packages | |
echo "Installing required packages..." | |
sudo apt-get install -y gnupg software-properties-common | |
# Add the HashiCorp GPG key | |
echo "Adding HashiCorp GPG key..." | |
wget -O- https://apt.releases.hashicorp.com/gpg | gpg --dearmor | sudo tee /usr/share/keyrings/hashicorp-archive-keyring.gpg >/dev/null | |
# Add the official HashiCorp repository | |
echo "Adding HashiCorp repository..." | |
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 | |
# Update the package index again | |
echo "Updating package index..." | |
sudo apt-get update | |
# Install Terraform | |
echo "Installing Terraform..." | |
sudo apt-get install -y terraform | |
# Verify Terraform installation | |
echo "Verifying Terraform installation..." | |
terraform --version | |
echo "Terraform installation complete!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment