Created
January 13, 2023 16:51
-
-
Save raykao/814a4aa9fa47bd247c37f1d2adfd1255 to your computer and use it in GitHub Desktop.
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
resource "azurerm_user_assigned_identity" "cluster" { | |
location = azurerm_resource_group.example.location | |
name = "aks-cluster-identity-${var.cluster_uid}" | |
resource_group_name = azurerm_resource_group.example.name | |
} | |
resource "azurerm_user_assigned_identity" "kubelet" { | |
location = azurerm_resource_group.example.location | |
name = "aks-kubelet-identity-${var.cluster_uid}" | |
resource_group_name = azurerm_resource_group.example.name | |
} | |
resource "azurerm_role_definition" "cluster-identity" { | |
role_definition_id = "00000000-0000-0000-0000-000000000000" | |
name = "aks-cluster-identity" | |
scope = ***Azure Resource ID e.g. RG/Storage/Compute*** | |
permissions { | |
actions = ["Microsoft.Resources/subscriptions/resourceGroups/read"] | |
not_actions = [] | |
} | |
assignable_scopes = [ | |
***Same as above***, | |
] | |
} | |
resource "azurerm_role_assignment" "cluster-identity" { | |
name = "00000000-0000-0000-0000-000000000000" | |
scope = ***your azure resource uuid*** | |
role_definition_id = azurerm_role_definition.cluster-identity.role_definition_resource_id | |
principal_id = azurerm_user_assigned_identity.cluster.object_id | |
} | |
resource "azurerm_role_definition" "kubelet-identity" { | |
role_definition_id = "00000000-0000-0000-0000-000000000000" | |
name = "aks-kubelet-identity" | |
scope = ***Azure Resource ID e.g. RG/Storage/Compute*** | |
permissions { | |
actions = ["Microsoft.Resources/subscriptions/resourceGroups/read"] | |
not_actions = [] | |
} | |
assignable_scopes = [ | |
***Same as above***, | |
] | |
} | |
resource "azurerm_role_assignment" "kubelet-identity" { | |
name = "00000000-0000-0000-0000-000000000000" | |
scope = ***your azure resource uuid*** | |
role_definition_id = azurerm_role_definition.kubelet-identity.role_definition_resource_id | |
principal_id = azurerm_user_assigned_identity.kubelet.object_id | |
} | |
resource "azurerm_kubernetes_cluster" "example" { | |
.... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment