-
Notifications
You must be signed in to change notification settings - Fork 652
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add azdo service endpoints for Azure container registry
- Loading branch information
Simon Schneider
committed
Nov 25, 2021
1 parent
86930a5
commit 8a3adfd
Showing
3 changed files
with
32 additions
and
0 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
caf_solution/add-ons/azure_devops_v1/azdo_service_endpoints_acr.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
data "azurerm_container_registry" "acr" { | ||
for_each = var.service_endpoints_acr | ||
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 = var.service_endpoints_acr | ||
|
||
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 = var.service_endpoints_acr | ||
|
||
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) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters