Skip to content

Commit

Permalink
Add SENTRY_DSN secrets to matchmaker and server
Browse files Browse the repository at this point in the history
  • Loading branch information
vladbat00 committed Nov 21, 2021
1 parent 177a17e commit 021ee55
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 2 deletions.
11 changes: 11 additions & 0 deletions k8s/agones/mr_server_fleet.tf
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,17 @@ resource "kubernetes_manifest" "mr_server_fleet" {
cpu = "500m"
}
}
env = [
{
name = "SENTRY_DSN"
valueFrom = {
secretKeyRef = {
name = "sentry-dsn"
key = "server"
}
}
}
]
}
]
}
Expand Down
9 changes: 9 additions & 0 deletions k8s/matchmaker/module.tf
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,15 @@ resource "kubernetes_deployment" "mr_matchmaker" {
name = "webhook"
container_port = 8081
}
env {
name = "SENTRY_DSN"
value_from {
secret_key_ref {
name = "sentry-dsn"
key = "matchmaker"
}
}
}
}
}
}
Expand Down
26 changes: 24 additions & 2 deletions module.tf
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,18 @@ variable "record_name" {
default = ""
}

variable "sentry_dsn_server" {
type = string
default = ""
sensitive = true
}

variable "sentry_dsn_matchmaker" {
type = string
default = ""
sensitive = true
}

provider "aws" {
profile = "default"
region = var.region
Expand Down Expand Up @@ -100,6 +112,16 @@ provider "kubernetes" {
}
}

resource "kubernetes_secret" "sentry_dsn" {
metadata {
name = "sentry-dsn"
}
data = {
server = var.sentry_dsn_server
matchmaker = var.sentry_dsn_matchmaker
}
}

variable "log_level" {
default = "info"
}
Expand All @@ -125,7 +147,7 @@ module "aws_autoscaler" {

module "matchmaker" {
source = "./k8s/matchmaker"
depends_on = [module.aws_load_balancer_controller, module.helm_agones]
depends_on = [module.aws_load_balancer_controller, module.helm_agones, kubernetes_secret.sentry_dsn]
}

module "web_client" {
Expand All @@ -150,7 +172,7 @@ module "route53" {
# Comment this out if running for the first time (i.e. when `helm_agones` is not installed).
module "agones" {
source = "./k8s/agones"
depends_on = [module.eks_cluster, module.helm_agones]
depends_on = [module.eks_cluster, module.helm_agones, kubernetes_secret.sentry_dsn]
}

// Next Helm module cause "terraform destroy" timeout, unless helm release would be deleted first.
Expand Down

0 comments on commit 021ee55

Please sign in to comment.