DevOps Classroomnotes 12/Oct/2022

Windows System Setup

  • Ensure your os is greater or Window 10
  • Softwares:
  • Chocolatey Refer Here
  • Git for windows: Refer Here
  • Terminal: Windows Terminal : From microsoft store on windows 10
  • IDE: Visual Studio Code choco install vscode -y
  • Terraform: choco install terraform -y

Mac System Setup

  • Ensure you install homebrew Refer Here
  • Git: brew install git -y
  • Visual Studio Code brew install --cask visual-studio-code -y
  • Terraform brew install terraform -y

Terraform Setup and configuration

  • Create a new folder hello_tf and open visual studio code.
  • In the visual studio code install extension terraform
    Preview

Activity 1: Creating a S3 bucket on AWS Cloud

  • Manual Steps:
    • Login into AWS Account (Free tier account)
    • Navigate to s3
      Preview
    • Create bucket
      Preview
      Preview
      Preview
      Preview
  • To Do similar stuff on terraform, we need to understand some terms
  • Provider: Provider tells terraform where do you want to create the infra, Generally there will be authentication details as well.
  • Resource : The infra component which we want to create, while creating resouce we need to pass some arguments
  • To write the template
    • Provider for AWS Refer Here
    • Resource for S3 bucket
      Preview
  • What we found:

    • provider => aws
    • resource => aws_s3_bucket
  • Syntax for provider
provider "<name of provider>" {
    argument_1 = "value_1"
    ...
    argument_n = "value_n"
}
  • Argument in Terraform is the input given by the user
  • All the arguments for AWS Provider Refer Here
  • Still we need to configure authentication, ignoring that the template is as shown below
provider "aws" {
    region = "ap-south-1"
}
  • Lets look at arguments of s3 bucket resource Refer Here
  • To Create a resource
resource "<type-of-resource>" "<name for reference in tf tempalte>" {
    argument_1 = "value_1"
    ...
    argument_n = "value_n"

}
  • Lets add the s3 resource to the template
provider "aws" {
    region = "ap-south-1"
}

resource "aws_s3_bucket" "first_bucket"  {
    bucket = "qttfoct12"
}
  • Next Steps:
    • Configuring authentication for terraform to use your AWS Account

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About continuous learner

devops & cloud enthusiastic learner