Skip to content

Commit 677a9b9

Browse files
added secrets
1 parent 0cd0f2f commit 677a9b9

File tree

2 files changed

+31
-11
lines changed

2 files changed

+31
-11
lines changed

terraform/rds.tf

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
11
resource "aws_db_subnet_group" "rds_subnet_group" {
22
name = "rds-subnet-group"
3-
subnet_ids = [aws_subnet.public.id, aws_subnet.private.id] # or private only
3+
subnet_ids = [
4+
aws_subnet.private_a.id,
5+
aws_subnet.private_b.id
6+
]
7+
8+
tags = {
9+
Name = "rds-subnet-group"
10+
}
411
}
512

13+
614
resource "aws_db_instance" "postgres" {
715
identifier = "node-api-db"
816
allocated_storage = 20

terraform/subnets.tf

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,33 @@
1-
# Public subnet
2-
resource "aws_subnet" "public" {
1+
# Public subnets
2+
resource "aws_subnet" "public_a" {
33
vpc_id = aws_vpc.main.id
44
cidr_block = "10.0.1.0/24"
55
availability_zone = "ap-south-1a"
66
map_public_ip_on_launch = true
7-
tags = {
8-
Name = "public-subnet"
9-
}
7+
tags = { Name = "public-a" }
108
}
119

12-
# Private subnet
13-
resource "aws_subnet" "private" {
10+
resource "aws_subnet" "public_b" {
1411
vpc_id = aws_vpc.main.id
1512
cidr_block = "10.0.2.0/24"
13+
availability_zone = "ap-south-1b"
14+
map_public_ip_on_launch = true
15+
tags = { Name = "public-b" }
16+
}
17+
18+
# Private subnets (RDS)
19+
resource "aws_subnet" "private_a" {
20+
vpc_id = aws_vpc.main.id
21+
cidr_block = "10.0.3.0/24"
1622
availability_zone = "ap-south-1a"
1723
map_public_ip_on_launch = false
18-
tags = {
19-
Name = "private-subnet"
20-
}
24+
tags = { Name = "private-a" }
25+
}
26+
27+
resource "aws_subnet" "private_b" {
28+
vpc_id = aws_vpc.main.id
29+
cidr_block = "10.0.4.0/24"
30+
availability_zone = "ap-south-1b"
31+
map_public_ip_on_launch = false
32+
tags = { Name = "private-b" }
2133
}

0 commit comments

Comments
 (0)