Skip to content

refactor: prod RDS 리소스 제거#63

Merged
Hexeong merged 3 commits into
mainfrom
refactor/61-terminate-rds-code
Jul 10, 2026
Merged

refactor: prod RDS 리소스 제거#63
Hexeong merged 3 commits into
mainfrom
refactor/61-terminate-rds-code

Conversation

@Hexeong

@Hexeong Hexeong commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

관련 이슈

작업 내용

  • enable_rds 기본값을 false로 변경했습니다.
  • stage/prod에서 중복으로 주입하던 enable_rds = false 설정을 제거했습니다.
  • DB 유저/권한 리소스를 rds.tf에서 db_users.tf로 분리했습니다.
  • prod 환경에서 기존 RDS와 RDS 보안그룹만 destroy되도록 정리했습니다.

특이 사항

  • rds.tf는 남겨두었습니다. 아직 Terraform state에 prod RDS 리소스가 남아 있으므로, 파일을 바로 제거하기보다 enable_rds = false를 통해 Terraform이 RDS와 RDS 보안그룹을 정상 destroy하도록 유지하는 편이 안전합니다.
  • RDS 삭제 전 수동 스냅샷은 생성 완료된 상태입니다.
  • 애플리케이션 datasource는 이미 DB EC2로 전환되어 정상 기동을 확인했습니다.

리뷰 요구사항 (선택)

  • RDS 삭제 plan이 의도대로 RDS와 RDS 보안그룹만 대상으로 하는지 확인 부탁드립니다.
  • 검증: terraform fmt -check -recursive environment/prod environment/stage modules/app_stack, git diff --check, stage/prod terraform validate, DB EC2 터널 기준 prod terraform plan 확인 완료 (Plan: 0 to add, 0 to change, 2 to destroy).

Summary by CodeRabbit

  • 변경 사항
    • 데이터베이스 사용자와 권한을 추가로 구성할 수 있습니다.
    • 별도 설정이 없는 경우 DB용 EC2가 기본적으로 비활성화됩니다.
    • 데이터베이스 환경 구성 방식이 변경되어 기존 환경 설정에 따라 RDS 사용 여부가 결정됩니다.
    • 기본 제공되던 RDS 인스턴스 및 관련 자동 사용자 설정은 제거되었습니다.

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@Hexeong, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 46 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 94a54839-1e44-4250-a353-cba69fd93568

📥 Commits

Reviewing files that changed from the base of the PR and between 533d7f5 and 66b0e16.

📒 Files selected for processing (3)
  • environment/prod/variables.tf
  • modules/app_stack/db_users.tf
  • modules/app_stack/variables.tf
📝 Walkthrough

Walkthrough

RDS 리소스를 제거하고, DB EC2 또는 RDS 활성화 시 추가 MySQL 사용자와 권한을 생성하도록 변경했습니다. DB EC2 기본값은 비활성화되며, Stage의 RDS 비활성화 강제 설정은 제거됩니다.

Changes

DB 백엔드 프로비저닝 전환

Layer / File(s) Summary
MySQL 프로비저닝 및 기본값 조정
modules/app_stack/variables.tf, modules/app_stack/rds.tf, modules/app_stack/db_users.tf
DB EC2 기본값을 false로 변경하고, RDS 리소스를 제거했습니다. DB EC2 또는 RDS가 활성화된 경우 추가 MySQL 사용자와 권한을 생성합니다.
Stage 백엔드 선택 연결
environment/stage/main.tf
stage_stack 모듈의 enable_rds = false 인자를 제거했습니다.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related issues

Possibly related PRs

Suggested labels: 인프라

Suggested reviewers: Gyuhyeok99, wibaek, lsy1307, JAEHEE25, sukangpunch, whqtker

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed 제목이 prod RDS 리소스 제거라는 핵심 변경을 간결하게 잘 요약합니다.
Description check ✅ Passed 관련 이슈, 작업 내용, 특이 사항, 리뷰 요구사항이 템플릿에 맞게 모두 작성되었습니다.
Linked Issues check ✅ Passed prod RDS 비활성화와 RDS 리소스 정리, DB EC2 전환에 필요한 Terraform 변경이 이슈 #61의 범위와 일치합니다.
Out of Scope Changes check ✅ Passed enable_db_ec2 기본값 변경과 db_users 분리는 RDS 제거 및 DB EC2 전환 흐름에 맞는 범위 내 변경입니다.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/61-terminate-rds-code

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Jul 10, 2026

Copy link
Copy Markdown

Terraform Plan: stage

No changes. Your infrastructure matches the configuration.

전체 plan 결과는 보안을 위해 댓글에 포함되지 않습니다. 워크플로우 실행 아티팩트를 확인하세요.

@github-actions

github-actions Bot commented Jul 10, 2026

Copy link
Copy Markdown

Terraform Plan: prod

Plan: 0 to add, 2 to change, 2 to destroy.

전체 plan 결과는 보안을 위해 댓글에 포함되지 않습니다. 워크플로우 실행 아티팩트를 확인하세요.

@Hexeong Hexeong self-assigned this Jul 10, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 533d7f5ea1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

description = "RDS 사용 여부"
type = bool
default = true
default = false

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve load-test source before disabling prod RDS

When this default is used by prod, Terraform will destroy the prod RDS instance, but the load-test stack still starts by applying environment/load_test (scripts/load_test/start.sh runs terraform apply) and that configuration looks up var.prod_rds_identifier via data.aws_db_instance.prod and the latest automated RDS snapshot in environment/load_test/main.tf:51-58. After the prod DB instance is gone, the Load Test Start workflow can no longer resolve those data sources, so load-test provisioning fails instead of restoring from the intended source. Please migrate the load-test stack to the new DB EC2/manual snapshot source, or keep a compatible RDS source, before disabling RDS by default.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

해당 지적은 맞습니다. 하지만 현재 #61은 prod 앱 전환 완료 후 운영 RDS 삭제가 목적이고, load-test 환경은 기존에도 별도 이슈로 분리하기로 했던 영역이므로 별도 이슈에서 처리하고자 합니다!

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@modules/app_stack/db_users.tf`:
- Around line 1-23: Mark additional_db_users as sensitive by adding sensitive =
true to its variable declarations in modules/app_stack/variables.tf and
environment/prod/variables.tf, preserving the existing type, default, and
description settings.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 21fdb8a8-d4f4-4563-af21-0203c1b27afc

📥 Commits

Reviewing files that changed from the base of the PR and between 47edaff and 533d7f5.

📒 Files selected for processing (4)
  • environment/stage/main.tf
  • modules/app_stack/db_users.tf
  • modules/app_stack/rds.tf
  • modules/app_stack/variables.tf
💤 Files with no reviewable changes (2)
  • environment/stage/main.tf
  • modules/app_stack/rds.tf

Comment thread modules/app_stack/db_users.tf

@lsy1307 lsy1307 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

야옹

@Hexeong Hexeong merged commit dc3b587 into main Jul 10, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor: RDS 삭제 및 DB EC2 전환 후 Terraform 정리

2 participants