169163334 - Switches to SystemAssigned managed identity
The SystemAssigned managed identity requires a preview feature to be enabled. ``` rgil@rem5:~/atst/terraform/providers/dev$ az feature list|grep MSIPreview "id": "/subscriptions/95934d54-980d-47cc-9bce-3a96bf9a2d1b/providers/Microsoft.Features/providers/Microsoft.ContainerService/features/MSIPreview", "name": "Microsoft.ContainerService/MSIPreview", rgil@rem5:~/atst/terraform/providers/dev$ az feature register --namespace Microsoft.ContainerService --name MSIPreview Once the feature 'MSIPreview' is registered, invoking 'az provider register -n Microsoft.ContainerService' is required to get the change propagated { "id": "/subscriptions/95934d54-980d-47cc-9bce-3a96bf9a2d1b/providers/Microsoft.Features/providers/Microsoft.ContainerService/features/MSIPreview", "name": "Microsoft.ContainerService/MSIPreview", "properties": { "state": "Registering" }, "type": "Microsoft.Features/providers/features" } rgil@rem5:~/atst/terraform/providers/dev$ az provider register -n Microsoft.ContainerService rgil@rem5:~/atst/terraform/providers/dev$ ``` This also now integrates the policy for keyvault with the k8s managed identity (system assigned).
This commit is contained in:
parent
c403dc557c
commit
623368b8dd
@ -25,6 +25,9 @@ resource "azurerm_kubernetes_cluster" "k8s" {
|
|||||||
min_count = var.min_count # FIXME: if auto_scaling disabled, set to 0
|
min_count = var.min_count # FIXME: if auto_scaling disabled, set to 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
identity {
|
||||||
|
type = "SystemAssigned"
|
||||||
|
}
|
||||||
lifecycle {
|
lifecycle {
|
||||||
ignore_changes = [
|
ignore_changes = [
|
||||||
default_node_pool.0.node_count
|
default_node_pool.0.node_count
|
||||||
|
@ -0,0 +1,3 @@
|
|||||||
|
output "principal_id" {
|
||||||
|
value = azurerm_kubernetes_cluster.k8s.identity[0].principal_id
|
||||||
|
}
|
@ -22,19 +22,15 @@ resource "azurerm_key_vault" "keyvault" {
|
|||||||
resource "azurerm_key_vault_access_policy" "keyvault" {
|
resource "azurerm_key_vault_access_policy" "keyvault" {
|
||||||
key_vault_id = azurerm_key_vault.keyvault.id
|
key_vault_id = azurerm_key_vault.keyvault.id
|
||||||
|
|
||||||
tenant_id = "b5ab0e1e-09f8-4258-afb7-fb17654bc5b3"
|
tenant_id = data.azurerm_client_config.current.tenant_id
|
||||||
object_id = "ca8cfc48-9995-4973-a8cc-6c7f755e84de"
|
object_id = var.principal_id
|
||||||
|
|
||||||
key_permissions = [
|
key_permissions = [
|
||||||
"get",
|
"get",
|
||||||
"list",
|
|
||||||
"create",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
secret_permissions = [
|
secret_permissions = [
|
||||||
"get",
|
"get",
|
||||||
"list",
|
|
||||||
"set",
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,3 +22,8 @@ variable "tenant_id" {
|
|||||||
type = string
|
type = string
|
||||||
description = "The Tenant ID"
|
description = "The Tenant ID"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
variable "principal_id" {
|
||||||
|
type = string
|
||||||
|
description = "The service principal_id of the k8s cluster"
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user