Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions infra/deployments/forms/health/grafana.tf
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ module "grafana" {
github_allowed_organizations = var.grafana_settings.github_allowed_organizations
github_admin_team = var.grafana_settings.github_admin_team
github_editor_teams = var.grafana_settings.github_editor_teams
github_viewer_teams = var.grafana_settings.github_viewer_teams
seconds_until_auto_pause = var.grafana_settings.seconds_until_auto_pause
rds_maintenance_window = var.environmental_settings.rds_maintenance_window

Expand Down
7 changes: 4 additions & 3 deletions infra/deployments/forms/inputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -240,9 +240,10 @@ variable "grafana_settings" {
enabled = optional(bool, false)
cpu = number
memory = number
github_allowed_organizations = list(string) # GitHub organisations whose members may sign in
github_admin_team = string # GitHub team (org/team) granted Grafana server admin
github_editor_teams = list(string) # GitHub teams (org/team) granted the Editor role; other org members are denied
github_allowed_organizations = list(string) # GitHub organisations whose members may sign in
github_admin_team = string # GitHub team (org/team) granted Grafana server admin
github_editor_teams = list(string) # GitHub teams (org/team) granted the Editor role
github_viewer_teams = optional(list(string), []) # GitHub teams (org/team) granted the Viewer role; members of no listed team are denied
seconds_until_auto_pause = optional(number, 3600)
})
nullable = false
Expand Down
1 change: 1 addition & 0 deletions infra/deployments/forms/tfvars/dev.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -135,4 +135,5 @@ grafana_settings = {
github_allowed_organizations = ["govuk-forms"]
github_admin_team = "govuk-forms/govuk-forms-infrastructure"
github_editor_teams = ["govuk-forms/govuk-forms-devs"]
github_viewer_teams = ["govuk-forms/govuk-forms-all"]
}
1 change: 1 addition & 0 deletions infra/deployments/forms/tfvars/production.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -192,4 +192,5 @@ grafana_settings = {
github_allowed_organizations = ["govuk-forms"]
github_admin_team = "govuk-forms/govuk-forms-infrastructure"
github_editor_teams = ["govuk-forms/govuk-forms-devs"]
github_viewer_teams = ["govuk-forms/govuk-forms-all"]
}
1 change: 1 addition & 0 deletions infra/deployments/forms/tfvars/staging.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,5 @@ grafana_settings = {
github_allowed_organizations = ["govuk-forms"]
github_admin_team = "govuk-forms/govuk-forms-infrastructure"
github_editor_teams = ["govuk-forms/govuk-forms-devs"]
github_viewer_teams = ["govuk-forms/govuk-forms-all"]
}
3 changes: 2 additions & 1 deletion infra/modules/grafana/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ Users sign in with GitHub and are sent straight to GitHub when they visit
Grafana. Access is limited to members of the organisations in
`github_allowed_organizations`, and a role is assigned from team membership:
`github_admin_team` members are Grafana server admins, `github_editor_teams`
members are editors, and anybody else is refused.
members are editors, `github_viewer_teams` members are viewers, and anybody
else is refused.

The built-in `admin` user remains for use when GitHub sign in is unavailable.
Its password is in the SSM parameter `/grafana/admin-password` and the login
Expand Down
3 changes: 2 additions & 1 deletion infra/modules/grafana/ecs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ locals {
# Grafana teams are exposed to the role mapping as "@<org>/<team>"
github_role_attribute_path = join(" || ", concat(
["contains(groups[*], '@${var.github_admin_team}') && 'GrafanaAdmin'"],
[for team in var.github_editor_teams : "contains(groups[*], '@${team}') && 'Editor'"]
[for team in var.github_editor_teams : "contains(groups[*], '@${team}') && 'Editor'"],
[for team in var.github_viewer_teams : "contains(groups[*], '@${team}') && 'Viewer'"]
))

environment_variables = [
Expand Down
6 changes: 6 additions & 0 deletions infra/modules/grafana/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ variable "github_editor_teams" {
type = list(string)
}

variable "github_viewer_teams" {
description = "GitHub teams (org/team) whose members are Grafana viewers"
type = list(string)
default = []
}

variable "seconds_until_auto_pause" {
description = "How long the database must be idle before it pauses"
type = number
Expand Down
Loading