Skip to content

Commit

Permalink
Enable AKS
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmyshah83 committed May 24, 2023
1 parent f2d1997 commit 10ed338
Showing 1 changed file with 30 additions and 30 deletions.
60 changes: 30 additions & 30 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,30 @@ resource "azurerm_resource_group" "rg_cc_gh_demo" {
name = random_pet.rg_name.id
}

#resource "azurerm_kubernetes_cluster" "aks_gh_demo" {
# location = azurerm_resource_group.rg_cc_gh_demo.location
# name = var.cluster_name
# resource_group_name = azurerm_resource_group.rg_cc_gh_demo.name
# dns_prefix = var.dns_prefix
# tags = {
# Environment = "Production"
# }
#
# default_node_pool {
# name = "agentpool"
# vm_size = "Standard_D2_v2"
# node_count = var.agent_count
# }
#
# identity {
# type = "SystemAssigned"
# }
#
# network_profile {
# network_plugin = "kubenet"
# load_balancer_sku = "standard"
# }
#}
resource "azurerm_kubernetes_cluster" "aks_gh_demo" {
location = azurerm_resource_group.rg_cc_gh_demo.location
name = var.cluster_name
resource_group_name = azurerm_resource_group.rg_cc_gh_demo.name
dns_prefix = var.dns_prefix
tags = {
Environment = "Production"
}

default_node_pool {
name = "agentpool"
vm_size = "Standard_D2_v2"
node_count = var.agent_count
}

identity {
type = "SystemAssigned"
}

network_profile {
network_plugin = "kubenet"
load_balancer_sku = "standard"
}
}

# NOTE: the Name used for Redis needs to be globally unique
resource "azurerm_redis_cache" "redis_gh_demo" {
Expand All @@ -57,12 +57,12 @@ resource "azurerm_container_registry" "acr_gh_demo" {
}

#Attach it to the cluster
#resource "azurerm_role_assignment" "acr_aks_role_assignment_gh_demo" {
# principal_id = azurerm_kubernetes_cluster.aks_gh_demo.kubelet_identity[0].object_id
# role_definition_name = "AcrPull"
# scope = azurerm_container_registry.acr_gh_demo.id
# skip_service_principal_aad_check = true
#}
resource "azurerm_role_assignment" "acr_aks_role_assignment_gh_demo" {
principal_id = azurerm_kubernetes_cluster.aks_gh_demo.kubelet_identity[0].object_id
role_definition_name = "AcrPull"
scope = azurerm_container_registry.acr_gh_demo.id
skip_service_principal_aad_check = true
}

# Drift DEMO Delete
resource "azurerm_resource_group" "rg_cc_gh_demo_drift" {
Expand Down

0 comments on commit 10ed338

Please sign in to comment.