Skip to content

Commit

Permalink
Added rds
Browse files Browse the repository at this point in the history
  • Loading branch information
qtkhajacloud committed Oct 26, 2022
1 parent 116516e commit 9b19f92
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 1 deletion.
1 change: 1 addition & 0 deletions Oct22/aws-ntier-new/.terraform.tfstate.lock.info
@@ -0,0 +1 @@
{"ID":"74667d82-a333-d7b5-06a8-722efb862537","Operation":"OperationTypeApply","Info":"","Who":"DESKTOP-TM7SH71\\Dell@DESKTOP-TM7SH71","Version":"1.3.2","Created":"2022-10-26T03:33:36.1548758Z","Path":"terraform.tfstate"}
27 changes: 27 additions & 0 deletions Oct22/aws-ntier-new/database.tf
@@ -0,0 +1,27 @@
# dbsubnet group

resource "aws_db_subnet_group" "mysqldbsubnetgroup" {
name = "mysqldbsubnetgroup"
subnet_ids = [ module.vpc.private_subnets[local.db_subnet_1], module.vpc.private_subnets[local.db_subnet_2] ]
depends_on = [
module.vpc
]
}


resource "aws_db_instance" "default" {
allocated_storage = 20
db_name = "qtrdsfromtf"
engine = "mysql"
engine_version = "5.7"
instance_class = "db.t2.micro"
username = "root"
password = "rootroot"
skip_final_snapshot = true
depends_on = [
module.vpc,
aws_db_subnet_group.mysqldbsubnetgroup
]
vpc_security_group_ids = [aws_security_group.rds_sg.id]
db_subnet_group_name = aws_db_subnet_group.mysqldbsubnetgroup.name
}
4 changes: 4 additions & 0 deletions Oct22/aws-ntier-new/locals.tf
Expand Up @@ -4,4 +4,8 @@ locals {
mysql_port = 3306
tcp = "tcp"
anywhere = "0.0.0.0/0"
db_subnet_1 = 0
db_subnet_2 = 1
app_subnet_1 = 2
app_subnet_2 = 3
}
1 change: 0 additions & 1 deletion Oct22/aws-ntier-new/security_groups.tf
Expand Up @@ -15,5 +15,4 @@ resource "aws_security_group" "rds_sg" {
tags = {
"Name" = "openmysql"
}

}

0 comments on commit 9b19f92

Please sign in to comment.