Merge pull request #283 from sschne/f/azdo-endpoint-container-registry

add-ons/azure_devops_v1: add service endpoints for Azure container registry
This commit is contained in:
lolorol 2022-01-18 12:07:03 +08:00 коммит произвёл GitHub
Родитель 0ea2723891 baae587226
Коммит 3b84cf6e82
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 39 добавлений и 0 удалений

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

@ -0,0 +1,36 @@
data "azurerm_container_registry" "acr" {
for_each = {
for key, value in var.service_endpoints : key => value
if try(value.type, "") == "AzureContainerRegistry"
}
name = local.remote.azure_container_registries[each.value.azure_container_registry.lz_key][each.value.azure_container_registry.key].name
resource_group_name = local.remote.azure_container_registries[each.value.azure_container_registry.lz_key][each.value.azure_container_registry.key].resource_group_name
}
resource "azuredevops_serviceendpoint_dockerregistry" "acr" {
for_each = {
for key, value in var.service_endpoints : key => value
if try(value.type, "") == "AzureContainerRegistry"
}
project_id = data.azuredevops_project.project[each.value.project_key].id
service_endpoint_name = each.value.endpoint_name
docker_registry = format("https://%s", data.azurerm_container_registry.acr[each.key].login_server)
docker_username = data.azurerm_container_registry.acr[each.key].admin_username
docker_password = data.azurerm_container_registry.acr[each.key].admin_password
registry_type = "Others"
}
resource "azuredevops_resource_authorization" "registry_endpoint" {
for_each = {
for key, value in var.service_endpoints : key => value
if try(value.type, "") == "AzureContainerRegistry"
}
project_id = data.azuredevops_project.project[each.value.project_key].id
resource_id = azuredevops_serviceendpoint_dockerregistry.acr[each.key].id
type = "endpoint"
authorized = try(each.value.authorized, false)
}

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

@ -54,6 +54,9 @@ locals {
azuread_groups = {
for key, value in try(var.landingzone.tfstates, {}) : key => merge(try(data.terraform_remote_state.remote[key].outputs.objects[key].azuread_groups, {}))
}
azure_container_registries = {
for key, value in try(var.landingzone.tfstates, {}) : key => merge(try(data.terraform_remote_state.remote[key].outputs.objects[key].azure_container_registries, {}))
}
keyvaults = {
for key, value in try(var.landingzone.tfstates, {}) : key => merge(try(data.terraform_remote_state.remote[key].outputs.objects[key].keyvaults, {}))
}