-
Notifications
You must be signed in to change notification settings - Fork 0
refactor: prod RDS 리소스 제거 #63
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| locals { | ||
| db_user_names = var.enable_rds || var.enable_db_ec2 ? toset(nonsensitive(keys(var.additional_db_users))) : toset([]) | ||
| } | ||
|
|
||
| resource "mysql_user" "users" { | ||
| for_each = local.db_user_names | ||
|
|
||
| user = each.key | ||
| host = "%" | ||
| plaintext_password = var.additional_db_users[each.key].password | ||
|
|
||
| depends_on = [ | ||
| aws_db_instance.default, | ||
| aws_instance.db_server, | ||
| ] | ||
| } | ||
|
|
||
| resource "mysql_grant" "user_grants" { | ||
| for_each = local.db_user_names | ||
|
|
||
| user = each.key | ||
| host = "%" | ||
| database = var.additional_db_users[each.key].database | ||
| privileges = var.additional_db_users[each.key].privileges | ||
|
|
||
| depends_on = [mysql_user.users] | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,7 +9,7 @@ variable "instance_type" { | |
| variable "enable_rds" { | ||
| description = "RDS 사용 여부" | ||
| type = bool | ||
| default = true | ||
| default = false | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When this default is used by prod, Terraform will destroy the prod RDS instance, but the load-test stack still starts by applying Useful? React with 👍 / 👎.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 해당 지적은 맞습니다. 하지만 현재 #61은 prod 앱 전환 완료 후 운영 RDS 삭제가 목적이고, load-test 환경은 기존에도 별도 이슈로 분리하기로 했던 영역이므로 별도 이슈에서 처리하고자 합니다! |
||
| } | ||
|
|
||
| variable "enable_db_ec2" { | ||
|
|
@@ -107,7 +107,8 @@ variable "additional_db_users" { | |
| database = string | ||
| privileges = list(string) | ||
| })) | ||
| default = {} | ||
| sensitive = true | ||
| default = {} | ||
| } | ||
|
|
||
| variable "db_engine_version" { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.