Skip to content

Commit bff09af

Browse files
authored
feat: Disable Run Command by default for AKS clusters (PSKD-1436) (#449)
Signed-off-by: David.Houck <David.Houck@sas.com>
1 parent 62b0266 commit bff09af

File tree

6 files changed

+21
-0
lines changed

6 files changed

+21
-0
lines changed

docs/CONFIG-VARS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ Ubuntu 20.04 LTS is the operating system used on the Jump/NFS servers. Ubuntu cr
211211
| aks_cluster_private_dns_zone_id | Specifies private DNS zone resource ID for AKS private cluster to use | string | "" | For `cluster_api_mode=private` if `aks_cluster_private_dns_zone_id` is not specified then the value `System` is used else it is set to null. For details see [Configure a private DNS zone](https://learn.microsoft.com/en-us/azure/aks/private-clusters?tabs=azure-portal#configure-a-private-dns-zone) |
212212
| aks_cluster_sku_tier | The SKU Tier that should be used for this Kubernetes Cluster. Optimizes api server for cost vs availability | string | "Free" | Valid Values: "Free", "Standard" and "Premium" |
213213
| cluster_support_tier | Specifies the support plan which should be used for this Kubernetes Cluster. | string | "KubernetesOfficial" | Possible values are `KubernetesOfficial` and `AKSLongTermSupport`. To enable long term K8s support is a combination of setting `aks_cluster_sku_tier` to `Premium` tier and explicitly selecting the `cluster_support_tier` as `AKSLongTermSupport`. For details see [Long term Support](https://learn.microsoft.com/en-us/azure/aks/long-term-support) and for which K8s version has long term support see [AKS Kubernetes release calendar](https://learn.microsoft.com/en-us/azure/aks/supported-kubernetes-versions?tabs=azure-cli#aks-kubernetes-release-calendar).|
214+
| aks_cluster_run_command_enabled | Enable or disable the AKS Run Command feature | bool | false | The AKS Run Command feature in AKS allows you to remotely execute commands within a running container of your AKS cluster directly from the Azure CLI or Azure portal. To enable the Run Command feature for an AKS cluster where Run Command is disabled, navigate to the Run Command tab for your AKS Cluster in the Azure Portal and select the Enable button. |
214215

215216
## Node Pools
216217

main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ module "aks" {
147147
aks_cluster_enable_host_encryption = var.aks_cluster_enable_host_encryption
148148
aks_node_disk_encryption_set_id = var.aks_node_disk_encryption_set_id
149149
aks_cluster_node_admin = var.node_vm_admin
150+
aks_cluster_run_command_enabled = var.aks_cluster_run_command_enabled
150151
aks_cluster_ssh_public_key = try(file(var.ssh_public_key), "")
151152
aks_cluster_private_dns_zone_id = var.aks_cluster_private_dns_zone_id
152153
aks_vnet_subnet_id = module.vnet.subnets["aks"].id

modules/azure_aks/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ resource "azurerm_kubernetes_cluster" "aks" {
2020
kubernetes_version = var.kubernetes_version
2121
private_cluster_enabled = var.aks_private_cluster
2222
private_dns_zone_id = var.aks_private_cluster && var.aks_cluster_private_dns_zone_id != "" ? var.aks_cluster_private_dns_zone_id : (var.aks_private_cluster ? "System" : null)
23+
run_command_enabled = var.aks_cluster_run_command_enabled
2324

2425
network_profile {
2526
# Docs on AKS Advanced Networking config

modules/azure_aks/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,3 +253,9 @@ variable "aks_cluster_private_dns_zone_id" {
253253
type = string
254254
default = ""
255255
}
256+
257+
variable "aks_cluster_run_command_enabled" {
258+
description = "Enable or disable the AKS cluster Run Command feature."
259+
type = bool
260+
default = false
261+
}

test/default_unit_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,12 @@ func TestPlanDefaults(t *testing.T) {
6565
assertFunction: assert.NotEqual,
6666
message: "The Jump VM machine type should be Standard_B2s",
6767
},
68+
"runCommandEnabledTest": {
69+
expected: "false",
70+
resourceMapName: "module.aks.azurerm_kubernetes_cluster.aks",
71+
attributeJsonPath: "{$.run_command_enabled}",
72+
message: "The AKS cluster Run Command feature should be disabled by default",
73+
},
6874
}
6975

7076
variables := getDefaultPlanVars(t)

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -802,3 +802,9 @@ variable "aks_cluster_private_dns_zone_id" {
802802
type = string
803803
default = ""
804804
}
805+
806+
variable "aks_cluster_run_command_enabled" {
807+
description = "Enable or disable the AKS cluster Run Command feature."
808+
type = bool
809+
default = false
810+
}

0 commit comments

Comments
 (0)