Skip to content

Commit be27be3

Browse files
committed
feat(DO-1067): Security improvements due to tfsec findings
1 parent 1ae08ac commit be27be3

File tree

3 files changed

+33
-18
lines changed

3 files changed

+33
-18
lines changed

README.md

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@ The following resources are used by this module:
4949

5050
The following input variables are required:
5151

52+
### api\_server\_ip\_ranges
53+
54+
Description: The IP ranges to allow for incoming traffic to the server nodes. To disable the limitation, set an empty list as value.
55+
56+
Type: `list(string)`
57+
5258
### client\_id
5359

5460
Description: Azure client ID to use to manage Azure resources from the cluster, like f.e. load balancers
@@ -91,6 +97,12 @@ Description: Three letter project key
9197

9298
Type: `string`
9399

100+
### rbac\_managed\_admin\_groups
101+
102+
Description: The group IDs that have admin access to the cluster. Have to be specified if rbac\_enabled is true
103+
104+
Type: `list(string)`
105+
94106
### resource\_group
95107

96108
Description: Azure Resource Group to use
@@ -225,15 +237,7 @@ Description: Enables RBAC on the cluster. If true, rbac\_managed\_admin\_groups
225237

226238
Type: `bool`
227239

228-
Default: `false`
229-
230-
### rbac\_managed\_admin\_groups
231-
232-
Description: The group IDs that have admin access to the cluster. Have to be specified if rbac\_enabled is true
233-
234-
Type: `list(string)`
235-
236-
Default: `[]`
240+
Default: `true`
237241

238242
### sku\_tier
239243

main.tf

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,22 @@ locals {
1111
cluster_name = "${lower(var.project)}${lower(var.stage)}k8s"
1212
}
1313

14+
# Log analytics required for OMS Agent result processing - usually other logging solutions are used. Hence the affected tfsec rule is
15+
# ignored here
16+
#
17+
# IP limit for API is not really ignored, since the variable requires to enter something. However one can decide to disable the limitation
18+
# and it would trigger the tfsec rule. Hence the affected tfsec rule is ignored here
19+
#
20+
#tfsec:ignore:azure-container-logging tfsec:ignore:azure-container-limit-authorized-ips
1421
resource "azurerm_kubernetes_cluster" "k8s" {
15-
name = local.cluster_name
16-
location = var.location
17-
resource_group_name = var.resource_group
18-
tags = var.tags
19-
dns_prefix = var.dns_prefix == "NONE" ? local.cluster_name : var.dns_prefix
20-
sku_tier = var.sku_tier
21-
kubernetes_version = var.kubernetes_version
22+
name = local.cluster_name
23+
location = var.location
24+
resource_group_name = var.resource_group
25+
tags = var.tags
26+
dns_prefix = var.dns_prefix == "NONE" ? local.cluster_name : var.dns_prefix
27+
sku_tier = var.sku_tier
28+
kubernetes_version = var.kubernetes_version
29+
api_server_authorized_ip_ranges = var.api_server_ip_ranges
2230

2331
default_node_pool {
2432
name = var.default_node_pool_name

vars.tf

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,12 @@ variable "node_storage" {
6969
variable "rbac_enabled" {
7070
type = bool
7171
description = "Enables RBAC on the cluster. If true, rbac_managed_admin_groups have to be specified."
72-
default = false
72+
default = true
7373
}
7474

7575
variable "rbac_managed_admin_groups" {
7676
type = list(string)
7777
description = "The group IDs that have admin access to the cluster. Have to be specified if rbac_enabled is true"
78-
default = []
7978
}
8079

8180
variable "default_node_pool_name" {
@@ -172,3 +171,7 @@ variable "ssh_public_key" {
172171
description = "SSH public key to access the kubernetes node with"
173172
}
174173

174+
variable "api_server_ip_ranges" {
175+
type = list(string)
176+
description = "The IP ranges to allow for incoming traffic to the server nodes. To disable the limitation, set an empty list as value."
177+
}

0 commit comments

Comments
 (0)