Revert "Add groups and permissions for azure_devops_v1"

This commit is contained in:
lolorol 2022-01-18 12:11:24 +08:00 коммит произвёл GitHub
Родитель be407eaa05
Коммит df26b02ddd
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
6 изменённых файлов: 2 добавлений и 68 удалений

Просмотреть файл

@ -52,15 +52,5 @@ resource "azuredevops_build_definition" "build_definition" {
value = jsonencode(variable.value)
}
}
}
# See https://registry.terraform.io/providers/microsoft/azuredevops/latest/docs/resources/build_definition_permissions#permissions for a list of available permissions.
resource "azuredevops_build_definition_permissions" "permissions" {
for_each = try(var.permissions.build_definitions, {})
project_id = data.azuredevops_project.project[each.value.project_key].id
principal = azuredevops_group.group[each.value.group_key].id
build_definition_id = azuredevops_build_definition.build_definition[each.key].id
permissions = each.value.permissions
}

Просмотреть файл

@ -1,10 +0,0 @@
data "azuredevops_users" "user" {
for_each = toset(var.group_settings.members.user_principal_names)
principal_name = each.value
}
resource "azuredevops_group_membership" "membership" {
group = var.group_descriptor
members = flatten(values(data.azuredevops_users.user)[*].users[*].descriptor)
}

Просмотреть файл

@ -1,7 +0,0 @@
terraform {
required_providers {
azuredevops = {
source = "microsoft/azuredevops"
}
}
}

Просмотреть файл

@ -1,5 +0,0 @@
variable "group_descriptor" {
}
variable "group_settings" {
}

Просмотреть файл

@ -35,32 +35,4 @@ resource "azuredevops_project_features" "project" {
"repositories" = try(lower(each.value.features.repositories), "disabled")
"testplans" = try(lower(each.value.features.testplans), "disabled")
}
}
resource "azuredevops_group" "group" {
for_each = var.groups
scope = data.azuredevops_project.project[each.value.project_key].id
display_name = each.value.display_name
description = each.value.description
}
module "azuredevops_group_membership" {
source = "./azuredevops_group_membership"
for_each = {
for key, value in var.groups : key => value
if try(value.members.user_principal_names, null) != null
}
group_descriptor = azuredevops_group.group[each.key].descriptor
group_settings = each.value
}
# See https://registry.terraform.io/providers/microsoft/azuredevops/latest/docs/resources/project_permissions#permissions for a list of available permissions.
resource "azuredevops_project_permissions" "project_perm" {
for_each = try(var.permissions.projects, {})
project_id = data.azuredevops_project.project[each.key].id
principal = azuredevops_group.group[each.value.group_key].id
permissions = each.value.permissions
}
}

Просмотреть файл

@ -75,9 +75,3 @@ variable "azdo_pat_admin" {
default = null
description = "(Optional). Azure Devops PAT Token. If not provided with this value must be retrieved from the Keyvault secret."
}
variable "groups" {
default = {}
}
variable "permissions" {
default = {}
}