Skip to content

Commit

Permalink
Create teams on Datadog
Browse files Browse the repository at this point in the history
  • Loading branch information
jdno committed Oct 6, 2023
1 parent da966ab commit d53025a
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 18 deletions.
34 changes: 17 additions & 17 deletions terraform/team-members-datadog/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion terraform/team-members-datadog/_terraform.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ terraform {
required_providers {
datadog = {
source = "datadog/datadog"
version = "3.24.1"
version = "3.30.0"
}
}

Expand Down
50 changes: 50 additions & 0 deletions terraform/team-members-datadog/teams.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
locals {
infra_admins = {
admin = datadog_user.users["admin"].id,
jdn = datadog_user.users["jdn"].id,
mark = datadog_user.users["mark"].id,
pietro = datadog_user.users["pietro"].id,
}
}

resource "datadog_team" "infra_admins" {
description = "Administrators of the infra-team"
handle = "infra-admins"
name = "infra-admins"
}

resource "datadog_team_membership" "infra_admins" {
for_each = local.infra_admins

team_id = datadog_team.infra_admins.id
user_id = each.value
}

resource "datadog_team" "infra" {
description = "The infrastructure team"
handle = "infra"
name = "infra"
}

resource "datadog_team_membership" "infra" {
for_each = merge(local.infra_admins, {
})

team_id = datadog_team.infra.id
user_id = each.value
}

resource "datadog_team" "crates_io" {
description = "The crates.io team"
handle = "crates-io"
name = "crates.io"
}

resource "datadog_team_membership" "crates_io" {
for_each = merge(local.infra_admins, {
tobias = datadog_user.users["tobias"].id,
})

team_id = datadog_team.crates_io.id
user_id = each.value
}

0 comments on commit d53025a

Please sign in to comment.