Closed jlotto8 closed 4 hours ago
Right, if the terraform package isn't in the apt cache, then it won't be able to install the package. You can check if a package in the apt cache using apt-cache show terraform
and that should return an exit code 0 if it's there. THEN you can install the package since it's confirmed to be available. If you have the repository sources added to apt incorrectly then you need to go back to that part and make sure you have the right source added and there was no errors in apt update. This is where deleting/rebuilding the VM to reset the env becomes super helpful since you can keep testing the scenario to make sure everything is getting set up correctly.
I'm assigning this to all 3 of us. I believe the problem is at least in part caused by our inability to understand and use 'apt get update' effectively 😂 @stephenlauck . I'm going to create another issue to assign to Devin because there needs to be some output printed with the result of a check if the Hashicorp repository was added correctly.
Upon testing there was an error: 'Unable to locate package terraform'
See below for complete output:
/usr/bin/gpg gnupg is already installed. software-properties-common is already installed Adding the HashiCorp GPG key and repository. /etc/apt/keyrings directory already exists. Hashicorp keyring file already exists. Installing Terraform... Reading package lists... Done Building dependency tree... Done Reading state information... Done E: Unable to locate package terraform Terraform is now installed on your computer 👏👏👏
As you see it was also confusing because the print statement ran, saying "Terraform is now installed on your computer 👏👏👏" when terraform was not properly installed. This needs to be addressed by adding a check before that line is printed to the screen.
Install Terraform
if command -v terraform then echo "Terraform is already installed" else echo "Installing Terraform..." sudo apt-get install -y terraform echo "Terraform is now installed on your computer 👏👏👏" fi