Oluwatomisin Bello
Posted on February 5, 2023
In this tutorial you would be needing an AWS console account and a Linux machine.
1.) Run the command below in a bash terminal to update the Linux software repository.
sudo apt update
2.) The next step after updating the Linux software repository is to install the following packages:
- gnupg
- software-properties-common
sudo apt-get install -y gnupg software-properties-common
3.) Download hashicorp signing key to a new keyring.
wget -O- https://apt.releases.hashicorp.com/gpg | gpg --dearmor | sudo tee /usr/share/keyrings/hashicorp-archive-keyring.gpg
4.) Verify the key's fingerprint
gpg --no-default-keyring --keyring /usr/share/keyrings/hashicorp-archive-keyring.gpg --fingerprint
5.) Add hashicop repository to your machine list of repositories allowing you to have access to softwares in the hashicorp online 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
6.) Install terraform
sudo apt update && sudo apt install terraform
7.) Verify if terraform is installed
terraform --help
8.) Login to your AWS user account
In this tutorial I am logged into a IAM user with admin permissions, I strongly recommend doing the same thing to avoid creating resources with the root account. After login, go to the IAM Service on the console, click on the security credentials and generate new access keys
Finally we with add the user credentials to the .bashrc file allowing the variables to be available globally on the machine
or we provide the user credentials for each project
9.) Run terraform init
Conclusion
Now that you have learnt how to link AWS user account Terrafrom you are ready to create resources and infrastructures using Terraform. You should however note that when linking AWS user account to Terraform locally for each project you should ensure not to push your user credentials to an online public website like GitHub.
Posted on February 5, 2023
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
November 17, 2024