Skip to content

Commit

Permalink
Update azurerm provider version 2.0 for AKS deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
deepanshumarwah committed Jul 27, 2020
1 parent 8382329 commit 14369a9
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 9 deletions.
25 changes: 18 additions & 7 deletions modules/azure-kubernetes-cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@ terraform {
required_version = ">= 0.12"
}

provider "azurerm" {
version = ">= 2.00"
features {}
}

resource "azurerm_kubernetes_cluster" "K8s" {
name = var.name
location = var.location
resource_group_name = var.resource_group_name
tags = var.tags
kubernetes_version = var.kubernetes_version
private_cluster_enabled = var.private_cluster_enabled
dns_prefix = var.dns_prefix

default_node_pool {
name = var.node_name
vm_size = var.vm_size
node_count = var.node_count
}

identity {
type = var.identity_type
}
Expand All @@ -31,10 +31,21 @@ resource "azurerm_kubernetes_cluster" "K8s" {

addon_profile {
oms_agent {
enabled = var.oms_agent_enabled
enabled = var.oms_agent_enabled
log_analytics_workspace_id = var.log_analytics_workspace_id
}
kube_dashboard {
enabled = var.kube_dashboard_enabled
}
}

default_node_pool {
name = var.node_name
vm_size = var.vm_size
enable_auto_scaling = var.enable_auto_scaling
node_count = var.node_count
vnet_subnet_id = var.vnet_subnet_id
os_disk_size_gb = var.os_disk_size_gb
tags = var.node_pool_tags
}
}
37 changes: 35 additions & 2 deletions modules/azure-kubernetes-cluster/vars.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ variable "dns_prefix" {
type = string
}

variable "kubernetes_version" {
description = "Version of Managed Kubernetes Cluster."
type = string
default = "1.16.10"
}

variable "private_cluster_enabled" {
description = "This is to expose API server to internal IP addresses only."
Expand All @@ -46,13 +51,18 @@ variable "network_plugin" {
variable "load_balancer_sku" {
description = "This is the sku for load balancer used for Kubernetes Cluster."
type = string
default = "standard"
default = "Standard"
}

variable "log_analytics_workspace_id" {
description = "The ID of log analytics workspace for AKS self monitoring by Sentinel."
type = string
}

variable "oms_agent_enabled" {
description = "This is to enable oms agent on AKS cluster for self monitoring by sentinel."
type = bool
default = false
default = true
}

variable "kube_dashboard_enabled" {
Expand All @@ -73,8 +83,31 @@ variable "vm_size" {
default = "Standard_DS1_v2"
}

variable "enable_auto_scaling" {
description = "This is to enable auto-scaling of nodes."
type = bool
default = false
}

variable "node_count" {
description = "The number of nodes required to be deployed."
type = number
default = 3
}

variable "vnet_subnet_id" {
description = "The subnet id inside vnet where aks cluster is to be deployed."
type = string
}

variable "os_disk_size_gb" {
description = "The size of os disk in gb."
type = string
default = "30"
}

variable "node_pool_tags" {
description = "A mapping of tags to assign to the nodes."
type = map(string)
default = {}
}

0 comments on commit 14369a9

Please sign in to comment.