Upgrade & Secure Your Future with DevOps, SRE, DevSecOps, MLOps!
We spend hours on Instagram and YouTube and waste money on coffee and fast food, but won’t spend 30 minutes a day learning skills to boost our careers.
Master in DevOps, SRE, DevSecOps & MLOps!
Learn from Guru Rajesh Kumar and double your salary in just one year.
code for creating ec2 instance and git repo
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "3.49.0"
}
github = {
source = "integrations/github"
version = "~> 4.0"
}
}
}
provider "aws" {
region = "us-west-2"
access_key = " "
secret_key = " "
}
resource "aws_instance" "first-ec2" {
ami = "ami-03d5c68bab01f3496" # us-west-2
instance_type = "t2.micro"
tags = {
Name = "godwin"
}
}
git repo using string variable
provider "github" {
token = "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" # or `GITHUB_TOKEN`
}
variable "reponame" {
type = string
description = "This is for demo of string variable"
default = "test_repo"
}
resource "github_repository" "example" {
name = "${var.reponame}"
description = "My awesome codebase"
private = false
}
git repo creating using list variable
variable "gitrepos" {
type = list
default = ["my_test1","my_test2","my_test3"]
description = "This is for demo of list variable"
}
resource "github_repository" "repo1" {
name = "${var.gitrepos[0]}"
description = "My awesome codebase"
private = false
}
resource "github_repository" "repo2" {
name = "${var.gitrepos[1]}"
description = "My awesome codebase"
private = false
}