Skip to content
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
2 changes: 1 addition & 1 deletion config/secrets
1 change: 1 addition & 0 deletions environment/prod/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ module "prod_stack" {
db_instance_type = var.db_ec2_instance_type
db_ami_id = var.db_ec2_ami_id
db_subnet_id = var.db_ec2_subnet_id
db_private_ip = var.db_ec2_private_ip
db_data_volume_size = var.db_data_volume_size

# 보안 그룹 규칙
Expand Down
5 changes: 5 additions & 0 deletions environment/prod/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ variable "db_ec2_subnet_id" {
type = string
}

variable "db_ec2_private_ip" {
description = "DB EC2에 고정할 Private IP (db_ec2_subnet_id 의 CIDR 안에 있어야 합니다)"
type = string
}
Comment on lines +36 to +39

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Update the secrets submodule for the required IP input

The prod plan/apply workflows check out config/secrets recursively and load prod_db.tfvars, but this commit leaves the submodule pinned at the previous cbceeaaba7de5fa1c944732d2223759fe4a44d2a revision. Because this new variable has no default, Terraform requires the pinned file to define it (HashiCorp variable reference); otherwise the prod CI run triggered by these changes cannot generate a plan or apply. Update the submodule pointer to the revision containing db_ec2_private_ip in the same change.

Useful? React with 👍 / 👎.


variable "db_data_volume_size" {
description = "DB EC2 MySQL data volume 크기 (GiB)"
type = number
Expand Down
2 changes: 2 additions & 0 deletions modules/app_stack/db_ec2.tf
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ resource "aws_instance" "db_server" {
ami = var.db_ami_id
instance_type = var.db_instance_type
subnet_id = var.db_subnet_id
# 인스턴스를 교체해도 Parameter Store 의 datasource 주소와 API 서버 설정을 그대로 쓰도록 주소를 고정합니다.
private_ip = var.db_private_ip

vpc_security_group_ids = [
aws_security_group.db_ec2_sg[count.index].id,
Expand Down
6 changes: 6 additions & 0 deletions modules/app_stack/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ variable "db_subnet_id" {
default = null
}

variable "db_private_ip" {
description = "DB EC2에 고정할 Private IP. 인스턴스를 교체해도 같은 주소를 유지해 datasource 설정을 바꾸지 않기 위해 사용합니다"
type = string
default = null
}

variable "db_data_volume_size" {
description = "DB EC2 MySQL data volume 크기 (GiB)"
type = number
Expand Down
Loading