locals {
  core_projects = {
    "core-images" = {
      name     = "core-images"
      slug     = "core-images"
      platform = "python-flask"
    },
    "core-reporting" = {
      name     = "core-reporting"
      slug     = "core-reporting"
      platform = "python-flask"
    },
    "atlas-um" = {
      name     = "atlas-um"
      slug     = "atlas-um"
      platform = "python-django"
    },
    "auth-proxy" = {
      name     = "auth-proxy"
      slug     = "auth-proxy"
      platform = "python-flask"
    },
    "notifications" = {
      name     = "notifications"
      slug     = "notifications"
      platform = "python-flask"
    },
    "core-load-tester" = {
      name     = "core-load-tester"
      slug     = "core-load-tester"
      platform = "python"
    },
  }
}

resource "sentry_project" "core_project" {
  for_each = local.core_projects

  organization = "gdb"
  team         = sentry_team.core.id
  name         = each.value["name"]
  slug         = each.value["slug"]
  platform     = each.value["platform"]
}

#resource "sentry_rule" "core_project_rule" {
#  for_each = local.core_projects
#
#  organization = "gdb"
#  project      = each.value["slug"]
#  action_match = "any"
#  frequency    = 30
#  environment  = null
#  name         = "Send a notification for new issues"
#
#  actions = [{
#    id = "sentry.rules.actions.notify_event.NotifyEventAction"
#  }]
#
#  conditions = [{
#    id = "sentry.rules.conditions.first_seen_event.FirstSeenEventCondition"
#  }]
#}
