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

feat: Add enable_microsoft_defender/upgrade_max_surge variables for a… #39

Merged
merged 1 commit into from
Apr 1, 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
11 changes: 10 additions & 1 deletion terraform/modules/az-aks/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ resource "azurerm_kubernetes_cluster" "aks" {
temporary_name_for_rotation = var.configuration.node_pool.temporary_name_for_rotation
enable_host_encryption = true
only_critical_addons_enabled = var.configuration.node_pool.only_critical_addons_enabled

upgrade_settings {
max_surge = var.configuration.node_pool.upgrade_max_surge
}
}

identity {
Expand All @@ -46,7 +50,12 @@ resource "azurerm_kubernetes_cluster" "aks" {
oms_agent {
log_analytics_workspace_id = var.log_analytics_id
}

dynamic "microsoft_defender" {
for_each = var.configuration.enable_microsoft_defender == false ? [] : ["microsoft_defender"]
content {
log_analytics_workspace_id = var.log_analytics_id
}
}
dynamic "key_management_service" {
for_each = var.configuration.kv_key_management_service_id == null ? [] : ["key_management_service"]

Expand Down
4 changes: 2 additions & 2 deletions terraform/modules/az-aks/tests/cluster_creation.tftest.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ run "plan" {
name = "az-aks-cluster"
configuration = {
version = "1.28.5"
sku = "Free"
sku = "Standard"
private_cluster = true
user_assigned_identity_id = run.setup.assigned_identity_id
local_account_disabled = true
Expand Down Expand Up @@ -100,7 +100,7 @@ run "apply" {
name = "az-aks-cluster"
configuration = {
version = "1.28.5"
sku = "Free"
sku = "Standard"
private_cluster = true
user_assigned_identity_id = run.setup.assigned_identity_id
local_account_disabled = true
Expand Down
2 changes: 2 additions & 0 deletions terraform/modules/az-aks/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ variable "configuration" {
public_ssh_key = optional(string)
automatic_channel_upgrade = optional(string)
kv_key_management_service_id = optional(string)
enable_microsoft_defender = optional(bool, true)
node_pool = object({
type = string
count = number
Expand All @@ -32,6 +33,7 @@ variable "configuration" {
max_pods = optional(number, 110)
temporary_name_for_rotation = optional(string)
only_critical_addons_enabled = optional(bool, true)
upgrade_max_surge = optional(string, "10%")
})
rbac = object({
enabled = bool
Expand Down