Skip to content

Commit

Permalink
Merge pull request #36 from Shion1305/shion/attach-secret-managers
Browse files Browse the repository at this point in the history
CloudRunにSecretManagerを追加
  • Loading branch information
Shion1305 authored Aug 18, 2024
2 parents 723c7bd + 6c83da5 commit 8ef9429
Show file tree
Hide file tree
Showing 2 changed files with 156 additions and 0 deletions.
117 changes: 117 additions & 0 deletions terraform/cloud-run.tf
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,123 @@ resource "google_cloud_run_v2_service" "release" {
port = 8080
}
}
env {
name = "DISCORD_AUTH_URL"
value_source {
secret_key_ref {
secret = data.google_secret_manager_secret.discord_auth_url.secret_id
version = "latest"
}
}
}
env {
name = "DISCORD_BOT_TOKEN"
value_source {
secret_key_ref {
secret = data.google_secret_manager_secret.discord_bot_token.secret_id
version = "latest"
}
}
}
env {
name = "DISCORD_CALLBACK_URI"
value_source {
secret_key_ref {
secret = data.google_secret_manager_secret.discord_callback_uri.secret_id
version = "latest"
}
}
}
env {
name = "DISCORD_CLIENT_ID"
value_source {
secret_key_ref {
secret = data.google_secret_manager_secret.discord_client_id.secret_id
version = "latest"
}
}
}
env {
name = "DISCORD_CLIENT_SECRET"
value_source {
secret_key_ref {
secret = data.google_secret_manager_secret.discord_client_secret.secret_id
version = "latest"
}
}
}
env {
name = "DISCORD_GUILD_ID"
value_source {
secret_key_ref {
secret = data.google_secret_manager_secret.discord_guild_id.secret_id
version = "latest"
}
}
}
env {
name = "DISCORD_MEMBER_ROLE_ID"
value_source {
secret_key_ref {
secret = data.google_secret_manager_secret.discord_member_role_id.secret_id
version = "latest"
}
}
}
env {
name = "FIREBASE_ADMIN_CERT_PATH"
value_source {
secret_key_ref {
secret = data.google_secret_manager_secret.firebase_admin_cert_path.secret_id
version = "latest"
}
}
}
env {
name = "JWT_SECRET"
value_source {
secret_key_ref {
secret = data.google_secret_manager_secret.jwt_secret.secret_id
version = "latest"
}
}
}
env {
name = "LINE_AUTH_URL"
value_source {
secret_key_ref {
secret = data.google_secret_manager_secret.line_auth_url.secret_id
version = "latest"
}
}
}
env {
name = "LINE_CALLBACK_URI"
value_source {
secret_key_ref {
secret = data.google_secret_manager_secret.line_callback_uri.secret_id
version = "latest"
}
}
}
env {
name = "LINE_CLIENT_ID"
value_source {
secret_key_ref {
secret = data.google_secret_manager_secret.line_client_id.secret_id
version = "latest"
}
}
}
env {
name = "LINE_CLIENT_SECRET"
value_source {
secret_key_ref {
secret = data.google_secret_manager_secret.line_client_secret.secret_id
version = "latest"
}
}
}
}
scaling {
max_instance_count = 100
Expand Down
39 changes: 39 additions & 0 deletions terraform/secrets.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
data "google_secret_manager_secret" "discord_auth_url" {
secret_id = "DISCORD_AUTH_URL"
}
data "google_secret_manager_secret" "discord_bot_token" {
secret_id = "DISCORD_BOT_TOKEN"
}
data "google_secret_manager_secret" "discord_callback_uri" {
secret_id = "DISCORD_CALLBACK_URI"
}
data "google_secret_manager_secret" "discord_client_id" {
secret_id = "DISCORD_CLIENT_ID"
}
data "google_secret_manager_secret" "discord_client_secret" {
secret_id = "DISCORD_CLIENT_SECRET"
}
data "google_secret_manager_secret" "discord_guild_id" {
secret_id = "DISCORD_GUILD_ID"
}
data "google_secret_manager_secret" "discord_member_role_id" {
secret_id = "DISCORD_MEMBER_ROLE_ID"
}
data "google_secret_manager_secret" "firebase_admin_cert_path" {
secret_id = "FIREBASE_ADMIN_CERT_PATH"
}
data "google_secret_manager_secret" "jwt_secret" {
secret_id = "JWT_SECRET"
}
data "google_secret_manager_secret" "line_auth_url" {
secret_id = "LINE_AUTH_URL"
}
data "google_secret_manager_secret" "line_callback_uri" {
secret_id = "LINE_CALLBACK_URI"
}
data "google_secret_manager_secret" "line_client_id" {
secret_id = "LINE_CLIENT_ID"
}
data "google_secret_manager_secret" "line_client_secret" {
secret_id = "LINE_CLIENT_SECRET"
}

0 comments on commit 8ef9429

Please sign in to comment.