Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tentando arrumaar bancos #18

Merged
merged 2 commits into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
75 changes: 75 additions & 0 deletions infra/rds.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,78 @@ resource "aws_db_subnet_group" "rds" {
Name = "DB subnet group"
}
}

resource "aws_security_group" "rds" {
name = "${var.app_name}-rds-sg"
description = "SG for RDS"
vpc_id = aws_vpc.vpc.id

ingress = [{
cidr_blocks = [ "187.19.185.104/32" ]
description = "Acesso banco de dado local"
from_port = 5432
ipv6_cidr_blocks = []
prefix_list_ids = []
protocol = "tcp"
security_groups = [aws_security_group.ecs.id]
self = false
to_port = 5432
}]

egress = [{
cidr_blocks = [ "0.0.0.0/0" ]
description = "RDS acesso externo"
from_port = 0
ipv6_cidr_blocks = []
prefix_list_ids = []
protocol = "-1"
security_groups = []
self = false
to_port = 0
}]
}

resource "aws_db_instance" "rds_clients" {
identifier = "${var.app_name}-rds-clients"
instance_class = "db.t3.micro"
allocated_storage = 10
engine = "postgres"
engine_version = "15.4"
username = var.db_rds_username
password = var.db_rds_password
db_name = var.db_name_clients
vpc_security_group_ids = [aws_security_group.rds.id]
publicly_accessible = true
skip_final_snapshot = true
db_subnet_group_name = aws_db_subnet_group.rds.name
}

resource "aws_db_instance" "rds_order" {
identifier = "${var.app_name}-rds-order"
instance_class = "db.t3.micro"
allocated_storage = 10
engine = "postgres"
engine_version = "15.4"
username = var.db_rds_username
password = var.db_rds_password
db_name = var.db_name_order
vpc_security_group_ids = [aws_security_group.rds.id]
publicly_accessible = true
skip_final_snapshot = true
db_subnet_group_name = aws_db_subnet_group.rds.name
}

resource "aws_db_instance" "rds_production" {
identifier = "${var.app_name}-rds-production"
instance_class = "db.t3.micro"
allocated_storage = 10
engine = "postgres"
engine_version = "15.4"
username = var.db_rds_username
password = var.db_rds_password
db_name = var.db_name_production
vpc_security_group_ids = [aws_security_group.rds.id]
publicly_accessible = true
skip_final_snapshot = true
db_subnet_group_name = aws_db_subnet_group.rds.name
}
44 changes: 0 additions & 44 deletions infra/rds_clients.tf

This file was deleted.

44 changes: 0 additions & 44 deletions infra/rds_order.tf

This file was deleted.

44 changes: 0 additions & 44 deletions infra/rds_production.tf

This file was deleted.

Loading