Edumall Preloader
WP Tutorials

Terraform Course – Automate your AWS cloud infrastructure

Terraform Course – Automate your AWS cloud infrastructure

Terraform Course – Automate your AWS cloud infrastructure



Learn Terraform in this complete course for beginners. Terraform is an open-source infrastructure as code software tool. Learn how it can be utilized to manage and automate your AWS cloud infrastructure. We’ll start off by setting up a free AWS account to play around with and move on to setting up and installing Terraform on a Windows/MAC/Linux machine.

From there we’ll move on to deploying our first resource through terraform and learning other core concepts. You’ll even get a chance to setup a simple web server in AWS.

💻 GitHub Repo: https://github.com/Sanjeev-Thiyagarajan/Terraform-Crash-Course

🔗 Download Terraform: https://www.terraform.io/downloads.html

🎥 This course was developed by Sanjeev Thiyagarajan. Check out his YouTube channel: https://www.youtube.com/channel/UC2sYgV-NV6S5_-pqLGChoNQ

⭐️ Course Contents ⭐️
⌨️ (0:00:00) Intro
⌨️ (0:01:54) AWS Setup
⌨️ (0:05:59) Windows Setup
⌨️ (0:10:04) Mac Setup
⌨️ (0:13:11) Linux Install
⌨️ (0:17:39) VSCode
⌨️ (0:20:51) Terraform Overview
⌨️ (0:43:31) Modifying Resources
⌨️ (0:50:30) Deleting Resources
⌨️ (0:54:55) Referencing Resources
⌨️ (1:04:47) Terraform Files
⌨️ (1:09:45) Practice Project
⌨️ (1:50:32) Terraform State Commands
⌨️ (1:54:05) Terraform Output
⌨️ (2:00:39) Target Resources
⌨️ (2:03:46) Terraform Variables

Learn to code for free and get a developer job: https://www.freecodecamp.org

Read hundreds of articles on programming: https://freecodecamp.org/news

source

Comments (44)

  1. Great walkthrough. Thank you!

  2. SamtaClaus

  3. 26K

  4. 057

  5. This is the 1000th comment. Thank you for the information you’ve shared; it has been very helpful.

  6. Excellent course, anyone watching in 2024 go for it is still relevant and upto date(i completed end to end) , I dont know there is something about Sanjeev's teaching method i always get it, he is very beginner friendly and want bore you trivia about the technology that he is teaching, he has very good hands-on approach, many thanks @freecodecamp and @sanjeevthiyagarajan(04/08/2024)

  7. this is the best Terraform Course in Youtube.

  8. I completed this course and at a great time. I was offered a position. Are YOU also teaching the azurerm course? I was able to follow you easily and get services deployed from my own personal aws account. I believe this job will also require some automation azure. Are you doing a crash course?

  9. Thank you for the great course!!!

  10. In 1:41:06 when you hit the Public IP address you got the result, But from my side, It is not working, Please help me.

  11. I am not able to connect the public ip address can someone help me

    # Configure the AWS Provider
    provider "aws" {
        region= "us-east-1"
        access_key = "AKIASDDHRRIRFOYARNMD"
        secret_key = "RiCfvP5VQTmNwKDGT8znf86q9yRt4uiISecziwyx"
      }
     
    # # 1. Create vpc
     
     resource "aws_vpc" "prod-vpc" {
       cidr_block = "10.0.0.0/16"
       tags = {
         Name = "production"
       }
     }
     
    # # 2. Create Internet Gateway
     
     resource "aws_internet_gateway" "gw" {
       vpc_id = aws_vpc.prod-vpc.id
     
     
     }
    # # 3. Create Custom Route Table
     
     resource "aws_route_table" "prod-route-table" {
       vpc_id = aws_vpc.prod-vpc.id
     
       route {
         cidr_block = "0.0.0.0/0"
         gateway_id = aws_internet_gateway.gw.id
       }
     
       route {
        ipv6_cidr_block = "::/0"
         gateway_id      = aws_internet_gateway.gw.id
       }
     
      tags = {
         Name = "Prod"
       }
     }
     
    # # 4. Create a Subnet
     
     resource "aws_subnet" "subnet-1" {
       vpc_id            = aws_vpc.prod-vpc.id
       cidr_block        = "10.0.1.0/24"
       availability_zone = "us-east-1a"
     
       tags = {
         Name = "prod-subnet"
       }
     }
     
    # # 5. Associate subnet with Route Table
     resource "aws_route_table_association" "a" {
       subnet_id      = aws_subnet.subnet-1.id
       route_table_id = aws_route_table.prod-route-table.id
     }
     # 6. Create Security Group to allow port 22,80,443
     resource "aws_security_group" "allow_web" {
       name        = "allow_web_traffic"
       description = "Allow Web inbound traffic"
       vpc_id      = aws_vpc.prod-vpc.id
     
       ingress {
         description = "HTTPS"
         from_port   = 443
         to_port     = 443
         protocol    = "tcp"
         cidr_blocks = ["0.0.0.0/0"]
       }
       ingress {
        description = "HTTP"
        from_port   = 80
         to_port     = 80
         protocol    = "tcp"
         cidr_blocks = ["0.0.0.0/0"]
       }
       ingress {
        description = "SSH"
         from_port   = 22
         to_port     = 22
         protocol    = "tcp"
         cidr_blocks = ["0.0.0.0/0"]
       }
     
       egress {
         from_port   = 0
         to_port     = 0
         protocol    = "-1"
         cidr_blocks = ["0.0.0.0/0"]  
         }
     
       tags = {
         Name = "allow_web"
       }
     }
     
    # # 7. Create a network interface with an ip in the subnet that was created in step 4
     
     resource "aws_network_interface" "web-server-nic" {
       subnet_id       = aws_subnet.subnet-1.id
       private_ips     = ["10.0.1.50"]
       security_groups = [aws_security_group.allow_web.id]
     
     }
    # # 8. Assign an elastic IP to the network interface created in step 7
     
     resource "aws_eip" "one" {
       vpc                       = true
       network_interface         = aws_network_interface.web-server-nic.id
       associate_with_private_ip = "10.0.1.50"
       depends_on                = [aws_internet_gateway.gw]
     }
     
     output "server_public_ip" {
       value = aws_eip.one.public_ip
     }
     
    # # 9. Create Ubuntu server and install/enable apache2
     
     resource "aws_instance" "web-server-instance" {
       ami               = "ami-04a81a99f5ec58529"
       instance_type     = "t2.micro"
       availability_zone = "us-east-1a"
       key_name          = "new"
     
       network_interface {
         device_index         = 0
         network_interface_id = aws_network_interface.web-server-nic.id
       }
     
       user_data = <<-EOF
                    #!/bin/bash
                    sudo apt update -y
                    sudo apt install apache2 -y
                    sudo systemctl start apache2
                    sudo bash -c 'echo your very first web server > /var/www/html/index.html'
                    EOF
       tags = {
         Name = "web-server"
       }
     }
     
     
     
    # output "server_private_ip" {
    #   value = aws_instance.web-server-instance.private_ip
     
    # }
     
    # output "server_id" {
    #   value = aws_instance.web-server-instance.id
    # }
     
     
    # resource "<provider>_<resource_type>" "name" {
    #     config options…..
    #     key = "value"
    #     key2 = "another value"
    # }

  12. when i am running terraform plan and terraform apply it is not woking in VS code. It is showing me this. Kindly help me

    PS C:Terraform> terraform plan

    No changes. Your infrastructure matches the configuration.

    Terraform has compared your real infrastructure against your configuration and found no differences, so no changes are needed.

    PS C:Terraform> terraform apply

    No changes. Your infrastructure matches the configuration.

    Terraform has compared your real infrastructure against your configuration and found no differences, so no changes are needed.

    Apply complete! Resources: 0 added, 0 changed, 0 destroyed.

  13. Excellent course and Thanks so much for it!

  14. tarraform : The term 'tarraform' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and

    try again.

    At line:1 char:1

    + tarraform -v

    + ~~~~~~~~~

    + CategoryInfo : ObjectNotFound: (tarraform:String) [], CommandNotFoundException

    + FullyQualifiedErrorId : CommandNotFoundException

  15. I tried following the instructions but got stuck

    The directory has no Terraform configuration files. You may begin working

    with Terraform immediately by creating Terraform configuration files.

  16. A couple of suggestions for content.

    One thing that I think people miss on the Variable side of Terraform is you can use JSON files to hold your variable values. I find this to be easier to use than tfvars files especially when dealing with objects.

    You also have a lot more tools at your disposal for the automation of generating those files or parsing them for other automations.

    Another to use is the power of the data resources. Pulling in data from a file, or even pulling in attributes of resources that were not defined in your current Terraform project.

  17. How to tell via terraform that I need redhat ec2 AMI image

  18. Great Tutorial !

  19. Excellent Video. I am a Data engineering guy and I wanted to learn this TF. No words Excellent.

  20. 1:29:30
    * Update *

    resource "aws_eip" "eip-1" {

    network_interface = aws_network_interface.UAT-eni.id

    associate_with_private_ip = "10.0.0.100"

    }

    In the latest Terraform AWS provider versions, specifying "vpc = true" is no longer necessary because all Elastic IPs are assumed to be associated with a VPC by default. Therefore, you can safely remove the "vpc" parameter from your aws_eip resource block:

  21. Can I use this course in 2024 to learn Terraform?

  22. How to install homebrew on older version of mac?? Whenever I try to install, it shows "We(and apple) no longer support older versions'. Help me please anyone🙏🙏

  23. Can you please create one more video where we do have separate .tf file for group of resources and also how are we resolving to secrets on prod ?

  24. Thank you for simplifying Terraform so effectively. Your breakdown of each concept is truly remarkable.

  25. Does anyone know what to do after this video?

  26. Great

  27. so much better, one place to cover all basics

  28. Great course. I just find it funny when you literally right click undo, copy and paste. What happened to the shortcuts? 🤣

  29. have anyone let me know, this course are still worth nowaday tho?

  30. I am not finding this html webpage and I am really struggling, can anyone help me out?

  31. This is a solid beginner for anyone interested in learning Terraform.

  32. Now that I look back into VSCode, it's kinda crazy when your instructor gets hyped up for VSCode's built-in terminal lol. VSCode has truly changed the development world

  33. Great tutorial – thank you! Just a question on the declarative language. At @45:00 you mentioned that we will always have one aws resource in the console because that is what is written in your code. So why does the console show two ec2 instances then? i.e. if the terraform code only has one ec2 instance, shouldn't terraform build it the same in the console too (by deleting the pre-existing ec2 and making a new one as per the main.tf file? – at this point there are two ec2 instances in the console while there is only one ec2 in the main.tf file)

  34. If amazon changes the ami names without formal warning then it isn't declarative?

  35. very helpful

  36. Feel like you spent too much time on the practice project…. teaching all those AWS tools were not really relevant… could have touched more on the different Terraform offerings such as modules, data, etc

  37. Thankyou for clearing my basics, I think I wouldn't need to dive deeper into tutorial hell

  38. great courses totally enjoyed it!

  39. The best course for beginners. I highly recommend everyone to start from here.

  40. really good course, but where is the proper authentication example?

  41. you wrote the wrong port…2 instead of 22

  42. 1.avoid terraform destroy..
    2.the order in which the code is written might not matter for terraform…but lets say its a good practice for clean code and it matters for the human reading that code.🙈

  43. Loved your video, I learned so much in this 2 hour tutorial. I'm now confident working with Terraform and hope to land a job in Cloud soon.

    For those having problems with server saying CONNECTION REFUSED it is most likely that the user data is not running. You can instead create a .sh file in the same folder of the Terraform project and add the commands there omitting the EOF, just add the lines with sudo. We then access the .sh file doing the following in the user_data section:
    user_data = file("${path.module}/filename.sh")

    That should work

    Also I just discovered we can Output more than one value by using a list:

    output "name" {
    value = [resource.propert1, resource.property2….]
    }

  44. My #!/bin/bash file is not working and hence I am not able to install the apache2 so I can't see the echo statement in the ipv4 public address so let me know if we have to create a bin folder first using bash..or something pretty new to this don't have much idea kindly help @andrewmgrube

Leave your thought here

Your email address will not be published. Required fields are marked *

Enable Notifications OK No thanks