devopshobbies / terraform-tutorial

you can follow up this repo to learn terraform with practical examples. also we recommend to check our youtube channel for this topic.
GNU General Public License v3.0
64 stars 25 forks source link

Devops Hobbies Terraform Tutorial

Devops hobbies terraform This is a brand new Persian Terraform free tutorial from @babakDoraniArab, contribute and improve this tutorial repo. There is a branch for each video on this repository that holds the codes that are written in the related video.

Also, if you would like to contribute just go and check the CONTRIBUTING.md file.

Table of Contents

  1. Terraform Installation
  2. Extensions
  3. About Course
  4. Related Courses

Installation

You can find your os related help for installation in below:

Linux
    Debian/Ubuntu #### Ubuntu/Debian Ensure that your system is up to date and you have installed the gnupg, software-properties-common, and curl packages installed. You will use these packages to verify HashiCorp's GPG signature and install HashiCorp's Debian package repository. ```bash sudo apt-get update && sudo apt-get install -y gnupg software-properties-common ``` Install the HashiCorp GPG key. ```bash wget -O- https://apt.releases.hashicorp.com/gpg | \ gpg --dearmor | \ sudo tee /usr/share/keyrings/hashicorp-archive-keyring.gpg ``` Verify the key's fingerprint. ```bash gpg --no-default-keyring \ --keyring /usr/share/keyrings/hashicorp-archive-keyring.gpg \ --fingerprint ``` The gpg command will report the key fingerprint: ``` /usr/share/keyrings/hashicorp-archive-keyring.gpg ------------------------------------------------- pub rsa4096 XXXX-XX-XX [SC] AAAA AAAA AAAA AAAA uid [ unknown] HashiCorp Security (HashiCorp Package Signing) sub rsa4096 XXXX-XX-XX [E] ``` Add the official HashiCorp repository to your system. The lsb_release -cs command finds the distribution release codename for your current system, such as buster, groovy, or sid. ```bash 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 ``` Download the package information from HashiCorp. ```bash sudo apt update ``` Install Terraform from the new repository. ```bash sudo apt-get install terraform ```
    CentOS/RHEL Install yum-config-manager to manage your repositories. ```bash sudo yum install -y yum-utils ``` Use yum-config-manager to add the official HashiCorp Linux repository. ```bash sudo yum-config-manager --add-repo https://rpm.releases.hashicorp.com/RHEL/hashicorp.repo ``` Install Terraform from the new repository. ```bash sudo yum -y install terraform ```
    Fedora ### Fedora Install `dnf config-manager` to manage your repositories. ```bash sudo dnf install -y dnf-plugins-core ``` Use `dnf config-manager` to add the official HashiCorp Linux repository. ```bash sudo dnf config-manager --add-repo https://rpm.releases.hashicorp.com/fedora/hashicorp.repo ``` Install Terraform from the new repository. ```bash sudo dnf -y install terraform ```
    Amazon-linux Install yum-config-manager to manage your repositories. ```bash sudo yum install -y yum-utils ``` Use yum-config-manager to add the official HashiCorp Linux repository. ```bash sudo yum-config-manager --add-repo https://rpm.releases.hashicorp.com/AmazonLinux/hashicorp.repo ``` Install Terraform from the new repository. ```bash sudo yum -y install terraform ```
Mac and Windows
    Homebrew OS X First, install the HashiCorp tap, a repository of all our Homebrew packages. ```bash brew tap hashicorp/tap ``` Now, install Terraform with hashicorp/tap/terraform. ```bash brew install hashicorp/tap/terraform ``` To update to the latest version of Terraform, first update Homebrew. ```bash brew update ``` Then, run the upgrade command to download and use the latest Terraform version. ```bash brew upgrade hashicorp/tap/terraform ```
    Chocolatey on Windows Chocolatey is a free and open-source package management system for Windows. Install the Terraform package from the command-line. ```cmd choco install terraform ```
Manual To install Terraform, find the [appropriate package](https://developer.hashicorp.com/terraform/downloads) for your system and download it as a zip archive. After downloading Terraform, unzip the package. Terraform runs as a single binary named `terraform`. Any other files in the package can be safely removed and Terraform will still function. Finally, make sure that the `terraform` binary is available on your `PATH`. This process will differ depending on your operating system.
    Mac or Linux Print a colon-separated list of locations in your PATH. ```bash echo $PATH ``` Move the Terraform binary to one of the listed locations. This command assumes that the binary is currently in your downloads folder and that your `PATH` includes `/usr/local/bin`, but you can customize it if your locations are different. ```bash mv ~/Downloads/terraform /usr/local/bin/ ``` For more detail about adding binaries to your path, see this [Stack Overflow article](https://stackoverflow.com/questions/14637979/how-to-permanently-set-path-on-linux).
    Windows [This Stack Overflow article](https://stackoverflow.com/questions/1618280/where-can-i-set-path-to-make-exe-on-windows) contains instructions for setting the PATH on Windows through the user interface.

Extensions

Effective programming with TLS (Terraform Language Server) to have syntax highlighting, intellisense, code formatting and etc.

Name Description
VsCode extension Terraform Extension for Visual Studio Code
Jetbrains IntelliJ-based IDEs extension Terraform Extension for Pycharm and other IntelliJ-based IDEs
LSP Mode Aims to provide IDE-like experience by providing optional integration with the most popular Emacs packages like company, flycheck and projectile
Infracost Useful extension for VS-Code to see const estimate of your terraform right in your editor

About Course

Leave a star on this repository and then subscribe to our Youtube channel. Be aware to turn on notification bell to get notified in case new video added.

Every episode codes are pushed to its related branch and you can check them below.

Watch V-P-N free.

If you have difficulties to connect to youtube there is an alternative way, you can use tools like Invidious.

Video lists

Episode Name branch Youtube
001 Introduction - watch
002 Why LaC - watch
003 Configuration management vs infrastructure orchestration - watch
004 Terraform Providers and basic AWS configuration to get programmatic access 004 watch
005 Create your first resource with terraform 005 watch
006 How to edit your resource and destroy your project 006 watch
007 Terraform variables and terraform variables 007 watch
008 Terraform variables and terraform variables 008 watch
009 Terraform remote backend 009 watch
010 terraform import and state rm 010 watch
011 terraform 011 create your first module 011 watch

Related courses:

You can find related courses below here, You can use them to leverage your devops skills. Even you can use some of them for this tutorial too. name Github Repository Youtube link Description
آموزش راه اندازی AWS روی لوکال (LocalStack) AWS local stack Watch You can simulate the aws services and use it for this course.
Amazon cloud (AWS) ---- Watch Learn the basics of aws
AWS webinar repository Watch Recorded webinars by Devops Hobbies for learning AWS.