Skip to content
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion projects/hello-world/hello-world-nodejs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const process = require('process');

var expressapp = express()
expressapp.get('/', function (req, res) {
res.send('{"message":"Hello World JavaScript v1"}')
res.send('{"message":"Hello World JavaScript v2"}')
})
expressapp.listen(5000, function () {
console.log('Ready on port 5000!')
Expand Down
2 changes: 1 addition & 1 deletion projects/hello-world/hello-world-python/launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
helloworld = Flask(__name__)
@helloworld.route("/")
def run():
return "{\"message\":\"Hello World Python v1\"}"
return "{\"message\":\"Hello World Python v2\"}"
if __name__ == "__main__":
helloworld.run(host="0.0.0.0", port=int("5000"), debug=True)
59 changes: 59 additions & 0 deletions terraform/05-ec2-instances/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
variable "aws_key_pair" {
default = "C:/Users/gemes/Downloads/terraform/aws_key_pair/default-ec2.pem"
}
provider "aws" {
region = "us-east-1"
}

//HTTP Server -> SG
//SG -> 80 TCP, 22 TCP, CIDR ["0.0.0.0/0"]
resource "aws_security_group" "http_server_sg" {
name = "http_server_sg"
vpc_id = "vpc-02523c91a94e96bca"

ingress {
from_port = 80
to_port = 80
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}

ingress {
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 = "http_server_sg"
}
}

resource "aws_instance" "http_server" {
ami = "ami-0b5eea76982371e91"
key_name = "default-ec2"
instance_type = "t2.micro"
vpc_security_group_ids = [aws_security_group.http_server_sg.id]
subnet_id = "subnet-09936102560fa544c"

connection {
type = "ssh"
host = self.public_ip
user = "ec2-user"
private_key = file(var.aws_key_pair)
}

provisioner "remote-exec" {
inline = [
"sudo yum install httpd -y",
"sudo service httpd start",
"echo Welcome to in28minutes - virtual server is at ${self.public_dns} | sudo tee /var/www/html/index.html"
]
}
}
7 changes: 7 additions & 0 deletions terraform/05-ec2-instances/output.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
output "aws_security_group_http_server_details" {
value = "aws_security_group_http_server_sg"
}

output "http_server_public_dns" {
value = aws_instance.http_server.public_dns
}
3 changes: 3 additions & 0 deletions terraform/05-ec2-instances/output1
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
output "aws_security_group_http_server_details" {
value = aws_security_group_http_server_sg
}
21 changes: 21 additions & 0 deletions terraform/Terraform/01-terraform-basics/04-maps/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
variable "users" {
default = {
ravs : { country : "Netherlands", department : "ABC" },
tom : { country : "US", department : "DEF" },
jane : { country : "India", department : "XYZ" }
}
}

provider "aws" {
region = "us-east-1"
}

resource "aws_iam_user" "my_iam_users" {
for_each = var.users
name = each.key
tags = {
#country:each.value
country : each.value.country
department : each.value.department
}
}
14 changes: 14 additions & 0 deletions terraform/Terraform/01-terraform-basics/05-ec2-instances/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
variable "names" {
default = ["ravs","sats","ranga", "tom","jane"]
}

provider "aws" {
region = "us-east-1"
}

resource "aws_iam_user" "my_iam_users" {
# count = length(var.names)
# name = var.names[count.index]
for_each = toset(var.names)
name = each.value
}
Binary file not shown.
9 changes: 9 additions & 0 deletions terraform/Terraform/01-terraform-basics/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
provider "aws" {
region = "us-east-1"
}

# resource "aws_s3_bucket_versioning""versioning_example"{
# bucket="aws_s3_bucket.my_s3_bucket.id"
#versioning_configuration {
# status= "Enabled"
#}
9 changes: 9 additions & 0 deletions terraform/Terraform/01-terraform-basics/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
output "my_s3_bucket_versioning" {
value = aws_s3_bucket.my_s3_bucket.versioning[0].enabled
}
output "my_s3_bucket_complete_details" {
value = aws_s3_bucket.my_s3_bucket
}
output "my_iam_user_complete_details" {
value = aws_iam_user.my_iam_user
}
10 changes: 10 additions & 0 deletions terraform/Terraform/01-terraform-basics/resources.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#plan-execute
resource "aws_s3_bucket" "my_s3_bucket" {
bucket = "my-s3-bucket-in28minutes-kahg-002"
versioning {
enabled = true
}
}
resource "aws_iam_user" "my_iam_user" {
name = "my_iam_user_gkk_update"
}
103 changes: 103 additions & 0 deletions terraform/Terraform/01-terraform-basics/terraform.tfstate copy.backup
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
{
"version": 4,
"terraform_version": "1.3.6",
"serial": 19,
"lineage": "d9c75993-9bb6-efe5-f34a-bd19bc924d88",
"outputs": {},
"resources": [
{
"mode": "managed",
"type": "aws_iam_user",
"name": "my_iam_users",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"index_key": "jane",
"schema_version": 0,
"attributes": {
"arn": "arn:aws:iam::355852034624:user/jane",
"force_destroy": false,
"id": "jane",
"name": "jane",
"path": "/",
"permissions_boundary": null,
"tags": null,
"tags_all": {},
"unique_id": "AIDAVFWTPEJAMCULGW6SN"
},
"sensitive_attributes": [],
"private": "bnVsbA=="
},
{
"index_key": "ranga",
"schema_version": 0,
"attributes": {
"arn": "arn:aws:iam::355852034624:user/ranga",
"force_destroy": false,
"id": "ranga",
"name": "ranga",
"path": "/",
"permissions_boundary": null,
"tags": null,
"tags_all": {},
"unique_id": "AIDAVFWTPEJAO4FJMFFZB"
},
"sensitive_attributes": [],
"private": "bnVsbA=="
},
{
"index_key": "ravs",
"schema_version": 0,
"attributes": {
"arn": "arn:aws:iam::355852034624:user/ravs",
"force_destroy": false,
"id": "ravs",
"name": "ravs",
"path": "/",
"permissions_boundary": null,
"tags": null,
"tags_all": {},
"unique_id": "AIDAVFWTPEJAG42DV5GUV"
},
"sensitive_attributes": [],
"private": "bnVsbA=="
},
{
"index_key": "sats",
"schema_version": 0,
"attributes": {
"arn": "arn:aws:iam::355852034624:user/sats",
"force_destroy": false,
"id": "sats",
"name": "sats",
"path": "/",
"permissions_boundary": null,
"tags": null,
"tags_all": {},
"unique_id": "AIDAVFWTPEJAGJDVS3IWP"
},
"sensitive_attributes": [],
"private": "bnVsbA=="
},
{
"index_key": "tom",
"schema_version": 0,
"attributes": {
"arn": "arn:aws:iam::355852034624:user/tom",
"force_destroy": false,
"id": "tom",
"name": "tom",
"path": "/",
"permissions_boundary": null,
"tags": null,
"tags_all": {},
"unique_id": "AIDAVFWTPEJAJNNDAAHPS"
},
"sensitive_attributes": [],
"private": "bnVsbA=="
}
]
}
],
"check_results": null
}
13 changes: 13 additions & 0 deletions terraform/Terraform/02-more-terraform-basics/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
variable "iam_user_name_prefix" {
type = string #any, number, bool, list, map, set, object, tuple
default = "my_iam_user"
}

provider "aws" {
region = "us-east-1"
}

resource "aws_iam_user" "my_iam_users" {
count = 1
name = "${var.iam_user_name_prefix}_${count.index}"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
iam_user_name_prefix = "VALUE_FORM_TERRAFORM_TFVARS"
14 changes: 14 additions & 0 deletions terraform/Terraform/03-lists-and-sets/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
variable "names" {
default = ["ravs","sats","ranga", "tom","jane"]
}

provider "aws" {
region = "us-east-1"
}

resource "aws_iam_user" "my_iam_users" {
# count = length(var.names)
# name = var.names[count.index]
for_each = toset(var.names)
name = each.value
}
14 changes: 14 additions & 0 deletions terraform/Terraform/04-maps/04-maps/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
variable "names" {
default = ["ravs","sats","ranga", "tom","jane"]
}

provider "aws" {
region = "us-east-1"
}

resource "aws_iam_user" "my_iam_users" {
# count = length(var.names)
# name = var.names[count.index]
for_each = toset(var.names)
name = each.value
}
5 changes: 5 additions & 0 deletions terraform/Terraform/05-ec2-instances
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
US East (N. Virginia)
Amazon Machine Image (AMI) ami-0b5eea76982371e91
Instance Type - t2.micro
VPC - vpc-02523c91a94e96bca
Security Group