Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add AKS permissions over the ACR #164

Merged
merged 1 commit into from
Oct 31, 2024
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
4 changes: 4 additions & 0 deletions terraform/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ module "azure_aks_pr" {
module.azuread_applications.identity_2
]

azure_container_registry_id = module.acr_proxy.id

tags = local.tags
}

Expand All @@ -132,6 +134,8 @@ module "azure_aks_nightly" {
module.azuread_applications.identity_2
]

azure_container_registry_id = module.acr_proxy.id

tags = local.tags
}

Expand Down
10 changes: 10 additions & 0 deletions terraform/modules/azure/aks/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,16 @@ resource "azurerm_kubernetes_cluster" "aks" {
}
}

## ACR Permissions

resource "azurerm_role_assignment" "kubweb_to_acr" {
scope = var.azure_container_registry_id
role_definition_name = "AcrPull"
principal_id = azurerm_kubernetes_cluster.aks.kubelet_identity[0].object_id
}

## Workload Identity Federation

resource "azurerm_federated_identity_credential" "msi_federation" {
count = length(var.workload_identity_applications)
name = "msi_federation-${local.cluster_full_name}-${var.workload_identity_applications[count.index].name}"
Expand Down
5 changes: 5 additions & 0 deletions terraform/modules/azure/aks/vars.tf
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ variable "node_resource_group_name" {
description = "AKS nodes resource group name"
}

variable "azure_container_registry_id" {
type = string
description = "Azure Container Registry ID"
}

variable "default_node_pool_count" {
type = number
default = 3
Expand Down
3 changes: 3 additions & 0 deletions terraform/modules/azure/registry/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
output "id" {
value = azurerm_container_registry.acr.id
}