diff --git a/Jenkins/test.txt b/Jenkins/test.txt new file mode 100644 index 0000000..bc3388c --- /dev/null +++ b/Jenkins/test.txt @@ -0,0 +1 @@ +this is a test file to check new branch getting pushed to global repo diff --git a/terraform_code/V1-EC2.tf b/terraform_code/V1-EC2.tf deleted file mode 100644 index 891975d..0000000 --- a/terraform_code/V1-EC2.tf +++ /dev/null @@ -1,9 +0,0 @@ -provider "aws" { - region = "us-east-1" -} - -resource "aws_instance" "demo-server" { - ami = "ami-022e1a32d3f742bd8" - instance_type = "t2.micro" - key_name = "dpp" -} \ No newline at end of file diff --git a/terraform_code/V2-EC2.tf b/terraform_code/V2-EC2.tf deleted file mode 100644 index 2c2cf52..0000000 --- a/terraform_code/V2-EC2.tf +++ /dev/null @@ -1,36 +0,0 @@ -provider "aws" { - region = "us-east-1" -} - -resource "aws_instance" "demo-server" { - ami = "ami-022e1a32d3f742bd8" - instance_type = "t2.micro" - key_name = "dpp" - security_groups = [ "demo-sg" ] -} - -resource "aws_security_group" "demo-sg" { - name = "demo-sg" - description = "SSH Access" - - ingress { - description = "Shh access" - 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"] - ipv6_cidr_blocks = ["::/0"] - } - - tags = { - Name = "ssh-prot" - - } -} \ No newline at end of file diff --git a/terraform_code/V3-EC2-With_VPC.tf b/terraform_code/V3-EC2-With_VPC.tf deleted file mode 100644 index 4bb5512..0000000 --- a/terraform_code/V3-EC2-With_VPC.tf +++ /dev/null @@ -1,93 +0,0 @@ -provider "aws" { - region = "us-east-1" -} - -resource "aws_instance" "demo-server" { - ami = "ami-053b0d53c279acc90" - instance_type = "t2.micro" - key_name = "dpp" - //security_groups = [ "demo-sg" ] - vpc_security_group_ids = [aws_security_group.demo-sg.id] - subnet_id = aws_subnet.dpp-public-subnet-01.id - -} - -resource "aws_security_group" "demo-sg" { - name = "demo-sg" - description = "SSH Access" - vpc_id = aws_vpc.dpp-vpc.id - - ingress { - description = "Shh access" - 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"] - ipv6_cidr_blocks = ["::/0"] - } - - tags = { - Name = "ssh-prot" - - } -} - -resource "aws_vpc" "dpp-vpc" { - cidr_block = "10.1.0.0/16" - tags = { - Name = "dpp-vpc" - } - -} - -resource "aws_subnet" "dpp-public-subnet-01" { - vpc_id = aws_vpc.dpp-vpc.id - cidr_block = "10.1.1.0/24" - map_public_ip_on_launch = "true" - availability_zone = "us-east-1a" - tags = { - Name = "dpp-public-subent-01" - } -} - -resource "aws_subnet" "dpp-public-subnet-02" { - vpc_id = aws_vpc.dpp-vpc.id - cidr_block = "10.1.2.0/24" - map_public_ip_on_launch = "true" - availability_zone = "us-east-1b" - tags = { - Name = "dpp-public-subent-02" - } -} - -resource "aws_internet_gateway" "dpp-igw" { - vpc_id = aws_vpc.dpp-vpc.id - tags = { - Name = "dpp-igw" - } -} - -resource "aws_route_table" "dpp-public-rt" { - vpc_id = aws_vpc.dpp-vpc.id - route { - cidr_block = "0.0.0.0/0" - gateway_id = aws_internet_gateway.dpp-igw.id - } -} - -resource "aws_route_table_association" "dpp-rta-public-subnet-01" { - subnet_id = aws_subnet.dpp-public-subnet-01.id - route_table_id = aws_route_table.dpp-public-rt.id -} - -resource "aws_route_table_association" "dpp-rta-public-subnet-02" { - subnet_id = aws_subnet.dpp-public-subnet-02.id - route_table_id = aws_route_table.dpp-public-rt.id -} \ No newline at end of file diff --git a/terraform_code/V4-EC2-With_VPC_for_each.tf b/terraform_code/V4-EC2-with-VPC-for-each.tf similarity index 60% rename from terraform_code/V4-EC2-With_VPC_for_each.tf rename to terraform_code/V4-EC2-with-VPC-for-each.tf index 0fcbe6e..b75df54 100644 --- a/terraform_code/V4-EC2-With_VPC_for_each.tf +++ b/terraform_code/V4-EC2-with-VPC-for-each.tf @@ -3,59 +3,55 @@ provider "aws" { } resource "aws_instance" "demo-server" { - ami = "ami-053b0d53c279acc90" - instance_type = "t2.micro" - key_name = "dpp" - //security_groups = [ "demo-sg" ] - vpc_security_group_ids = [aws_security_group.demo-sg.id] - subnet_id = aws_subnet.dpp-public-subnet-01.id -for_each = toset(["jenkins-master", "build-slave", "ansible"]) - tags = { - Name = "${each.key}" - } + ami = "ami-053b0d53c279acc90" + instance_type = "t2.micro" + key_name = "devops2" + //security_groups = [ "demo-sg" ] + vpc_security_group_ids = [aws_security_group.demo-sg.id] + subnet_id = aws_subnet.dpp-public-subnet-01.id + for_each = toset(["Jenkins-master","Jenkins-slave","ansible"]) + tags = { + Name = "${each.key}" + } } resource "aws_security_group" "demo-sg" { name = "demo-sg" - description = "SSH Access" - vpc_id = aws_vpc.dpp-vpc.id - + description = "Allow ssh inbound traffic" + vpc_id = aws_vpc.dpp-vpc.id + ingress { - description = "SHH access" + description = "SSH Access" from_port = 22 to_port = 22 protocol = "tcp" cidr_blocks = ["0.0.0.0/0"] - } + } - ingress { - description = "Jenkins port" + ingress { + description = "https Access for jenkins" from_port = 8080 to_port = 8080 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"] - ipv6_cidr_blocks = ["::/0"] - } - + } tags = { - Name = "ssh-prot" - - } + Name = "ssh-port" + } } resource "aws_vpc" "dpp-vpc" { - cidr_block = "10.1.0.0/16" - tags = { - Name = "dpp-vpc" - } - + cidr_block = "10.1.0.0/16" + tags = { + Name = "dpp-vpc" + } } resource "aws_subnet" "dpp-public-subnet-01" { @@ -64,7 +60,7 @@ resource "aws_subnet" "dpp-public-subnet-01" { map_public_ip_on_launch = "true" availability_zone = "us-east-1a" tags = { - Name = "dpp-public-subent-01" + name = "dpp-public-subnet-01" } } @@ -74,31 +70,33 @@ resource "aws_subnet" "dpp-public-subnet-02" { map_public_ip_on_launch = "true" availability_zone = "us-east-1b" tags = { - Name = "dpp-public-subent-02" + name = "dpp-public-subnet-02" } } resource "aws_internet_gateway" "dpp-igw" { - vpc_id = aws_vpc.dpp-vpc.id + vpc_id = aws_vpc.dpp-vpc.id tags = { Name = "dpp-igw" - } + } } resource "aws_route_table" "dpp-public-rt" { - vpc_id = aws_vpc.dpp-vpc.id + vpc_id = aws_vpc.dpp-vpc.id route { cidr_block = "0.0.0.0/0" - gateway_id = aws_internet_gateway.dpp-igw.id + gateway_id = aws_internet_gateway.dpp-igw.id } } resource "aws_route_table_association" "dpp-rta-public-subnet-01" { subnet_id = aws_subnet.dpp-public-subnet-01.id - route_table_id = aws_route_table.dpp-public-rt.id + route_table_id = aws_route_table.dpp-public-rt.id } resource "aws_route_table_association" "dpp-rta-public-subnet-02" { - subnet_id = aws_subnet.dpp-public-subnet-02.id - route_table_id = aws_route_table.dpp-public-rt.id -} \ No newline at end of file + subnet_id = aws_subnet.dpp-public-subnet-02.id + route_table_id = aws_route_table.dpp-public-rt.id +} + + diff --git a/terraform_code/vpc/V5-eks_setup.tf b/terraform_code/vpc/V5-eks_setup.tf index 905caf5..5e19aac 100644 --- a/terraform_code/vpc/V5-eks_setup.tf +++ b/terraform_code/vpc/V5-eks_setup.tf @@ -9,7 +9,7 @@ resource "aws_instance" "demo-server" { //security_groups = [ "demo-sg" ] vpc_security_group_ids = [aws_security_group.demo-sg.id] subnet_id = aws_subnet.dpp-public-subnet-01.id -for_each = toset(["jenkins-master", "build-slave", "ansible"]) +for_each = toset(["jenkins-master", "jenkins-slave", "ansible"]) tags = { Name = "${each.key}" }