Terraform Assignment- Day01 – 4th July 2022 by Arup Kr Pyne

Limited Time Offer!

For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!

Enroll Now

Assignment – 1: List of Components of Terraform and explain each components with 1 image


Terraform has two important components: Terraform Core and Terraform Plugins.

Terraform Core oversees the reading and interpolation of resource plan executions, resource graphs, state management features and configuration files. Core is composed of compiled binaries written in the Go programming language. Each compiled binary acts as a command-line interface (CLI) for communicating with plugins through remote procedure calls (RPC).

Terraform Plugins are responsible for defining resources for specific services. This includes authenticating infrastructure providers and initializing the libraries used to make API calls. Terraform Plugins are written in Go as executable binaries that can either be used as a specific service or as a provisioner. (Provisioner plugins are used to execute commands for a designated resource.)

Assignment – 2 : Write a terraform file which must create 1 azure resources group + 1 aws instance and 1 github repo. All the code must be into 1 file including providers.

terraform {
  required_providers {
    azurerm = {
      source = "hashicorp/azurerm"
      version = "3.12.0"
    }
    aws = {
      source = "hashicorp/aws"
      version = "4.21.0"
    }
  github = {
      source  = "integrations/github"
      version = "4.26.1"
    }
  }
}


provider "azurerm" {
  features {}
  subscription_id = "54d18623-a88e-4b6e-bcfe-a772406993b0"
  client_id       = "7e757450-7239-4c36-88f8-6664f3e49a49"
  client_secret   = "yhJ8Q~T7ycWjr4PjQ2ZUkTKgLeKTQ82YYGdiscP9"
  tenant_id       = "bc0f52a6-5a6d-45f4-8842-36ab113a5eb5"
}

provider "aws" {
    access_key = "test-AKIAQ6GAIA5XIHHM2GJM"
    secret_key = "test-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"
    region = "eu-west-3"
}

provider "github" {
  token = "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"
}

 
resource "azurerm_resource_group" "asgnmt2_rg" {
  name     = "day1-asgnmt2-rg-01"
  location = "East US"
}

resource "github_repository" "repo" {
  name        = "day1-asgnmt2-repo"
  description = "Day01-Assignment02 github repo using Terraform script"
  visibility = "public"
}

resource "aws_instance" "web" {
  ami           = "ami-08df646e18b182346"
  instance_type = "t3.micro"
  tags = {
    Name = "Day01-Assignment02"
  }
}
Subscribe
Notify of
guest

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

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x