Skip to content
14 changes: 0 additions & 14 deletions terraform/environments/dev/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,4 @@ module "application" {
server_tags = module.tags.server_tags
}

module "database" {
source = "../../modules/database"

vpc_id = module.network.vpc_id
project_name = var.project_name
db_name = var.db_name
secret_name = var.db_secret_name
ingress_security_group_ids = [module.application.application_sg_id, module.bastion.bastion_sg_id]

private_subnet_ids = module.network.private_subnet_ids
server_tags = module.tags.server_tags
database_tags = module.tags.database_tags
}


16 changes: 0 additions & 16 deletions terraform/environments/dev/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -62,19 +62,3 @@ output "application_launch_template_id" {
description = "Launch Template ID for application instances"
value = module.application.launch_template_id
}

# Database
output "database_endpoint" {
description = "Endpoint of the RDS database"
value = module.database.db_instance_endpoint
}

output "database_id" {
description = "ID of the RDS database instance"
value = module.database.db_instance_id
}

output "database_sg_id" {
description = "Security Group ID for the database"
value = module.database.database_sg_id
}
6 changes: 0 additions & 6 deletions terraform/environments/dev/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,3 @@ variable "bucket_name" {
variable "key_pair_name" {
default = "prolog-dev"
}
variable "db_name" {
default = "prolog"
}
variable "db_secret_name" {
default = "secrets/prolog_dev"
}
14 changes: 0 additions & 14 deletions terraform/environments/prod/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,4 @@ module "application" {
server_tags = module.tags.server_tags
}

module "database" {
source = "../../modules/database"

vpc_id = module.network.vpc_id
project_name = var.project_name
db_name = var.db_name
secret_name = var.db_secret_name
ingress_security_group_ids = [module.application.application_sg_id, module.bastion.bastion_sg_id]

private_subnet_ids = module.network.private_subnet_ids
server_tags = module.tags.server_tags
database_tags = module.tags.database_tags
}


16 changes: 0 additions & 16 deletions terraform/environments/prod/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -62,19 +62,3 @@ output "application_launch_template_id" {
description = "Launch Template ID for application instances"
value = module.application.launch_template_id
}

# Database
output "database_endpoint" {
description = "Endpoint of the RDS database"
value = module.database.db_instance_endpoint
}

output "database_id" {
description = "ID of the RDS database instance"
value = module.database.db_instance_id
}

output "database_sg_id" {
description = "Security Group ID for the database"
value = module.database.database_sg_id
}
6 changes: 0 additions & 6 deletions terraform/environments/prod/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,3 @@ variable "bucket_name" {
variable "key_pair_name" {
default = "prolog-prod"
}
variable "db_name" {
default = "prolog"
}
variable "db_secret_name" {
default = "secrets/prolog_prod"
}
4 changes: 2 additions & 2 deletions terraform/modules/application/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ resource "aws_autoscaling_group" "asg" {
}

max_size = 4
min_size = 0
desired_capacity = 0
min_size = 1
desired_capacity = 1

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

ASG의 min_sizedesired_capacity가 모듈 내에 하드코딩되어 있습니다. 이는 다음과 같은 잠재적인 문제를 야기할 수 있습니다:

  1. 환경별 확장성 및 가용성 제한: devprod 환경이 동일한 모듈을 사용하므로, 운영 환경(prod)에서도 인스턴스가 1대로 제한됩니다. 고가용성(HA)을 위해 운영 환경에서는 최소 2대 이상의 인스턴스를 유지하는 것이 권장되므로, 이 값들을 변수화하여 각 환경에서 적절한 값을 전달하도록 개선하는 것이 좋습니다.
  2. 오토스케일링 충돌: desired_capacity를 명시적으로 설정하면, 향후 오토스케일링 정책에 의해 인스턴스 수가 늘어나더라도 terraform apply 실행 시 다시 1대로 줄어드는 현상이 발생합니다. 이를 방지하기 위해 lifecycle 블록에서 ignore_changes = [desired_capacity] 설정을 추가하는 것을 고려해 보시기 바랍니다.

vpc_zone_identifier = var.private_subnet_ids

// Note: 이후 target_group_arns는 CodeDeploy에서 알아서 관리 예정
Expand Down
58 changes: 0 additions & 58 deletions terraform/modules/database/main.tf

This file was deleted.

39 changes: 0 additions & 39 deletions terraform/modules/database/outputs.tf

This file was deleted.

16 changes: 0 additions & 16 deletions terraform/modules/database/variables.tf

This file was deleted.

7 changes: 0 additions & 7 deletions terraform/modules/secret/main.tf

This file was deleted.

3 changes: 0 additions & 3 deletions terraform/modules/secret/outputs.tf

This file was deleted.

1 change: 0 additions & 1 deletion terraform/modules/secret/variables.tf

This file was deleted.

3 changes: 0 additions & 3 deletions terraform/modules/tags/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ locals {
storage_tags = merge(local.common_tags, {
Role = "${var.project_name}-storage"
})
database_tags = merge(local.common_tags, {
Role = "${var.project_name}-db"
})
service_worker_tags = merge(local.common_tags, {
Role = "service-worker"
})
Expand Down
5 changes: 0 additions & 5 deletions terraform/modules/tags/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@ output "storage_tags" {
value = local.storage_tags
}

output "database_tags" {
description = "Tags for database resources"
value = local.database_tags
}

output "service_worker_tags" {
description = "Tags for service worker resources"
value = local.service_worker_tags
Expand Down
Loading