Skip to content

Commit c3f964e

Browse files
authored
Merge pull request #6 from dodevops/bugfix/te/azurermfixes
Managed identity and adaptions for newer provider versions
2 parents 2387f67 + 8d9249c commit c3f964e

File tree

3 files changed

+16
-36
lines changed

3 files changed

+16
-36
lines changed

README.md

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -55,18 +55,6 @@ Description: The IP ranges to allow for incoming traffic to the server nodes. To
5555

5656
Type: `list(string)`
5757

58-
### client\_id
59-
60-
Description: Azure client ID to use to manage Azure resources from the cluster, like f.e. load balancers
61-
62-
Type: `string`
63-
64-
### client\_secret
65-
66-
Description: Azure client secret to use to manage Azure resources from the cluster, like f.e. load balancers
67-
68-
Type: `string`
69-
7058
### default\_node\_pool\_k8s\_version
7159

7260
Description: Version of kubernetes for the default node pool
@@ -175,7 +163,7 @@ Description: The SKU for the used Load Balancer
175163

176164
Type: `string`
177165

178-
Default: `"Basic"`
166+
Default: `"basic"`
179167

180168
### max\_pods
181169

main.tf

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,13 @@ locals {
1919
#
2020
#tfsec:ignore:azure-container-logging tfsec:ignore:azure-container-limit-authorized-ips
2121
resource "azurerm_kubernetes_cluster" "k8s" {
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
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
3029

3130
default_node_pool {
3231
name = var.default_node_pool_name
@@ -40,9 +39,12 @@ resource "azurerm_kubernetes_cluster" "k8s" {
4039
zones = var.availability_zones
4140
}
4241

43-
service_principal {
44-
client_id = var.client_id
45-
client_secret = var.client_secret
42+
api_server_access_profile {
43+
authorized_ip_ranges = var.api_server_ip_ranges
44+
}
45+
46+
identity {
47+
type = "SystemAssigned"
4648
}
4749

4850
role_based_access_control_enabled = var.rbac_enabled
@@ -55,7 +57,7 @@ resource "azurerm_kubernetes_cluster" "k8s" {
5557
network_profile {
5658
network_plugin = "azure"
5759
network_policy = var.network_policy
58-
load_balancer_sku = length(var.node_pools) > 0 ? "Standard" : var.load_balancer_sku
60+
load_balancer_sku = length(var.node_pools) > 0 ? "standard" : var.load_balancer_sku
5961
dynamic "load_balancer_profile" {
6062
for_each = azurerm_public_ip.public-ip-outbound
6163
content {

vars.tf

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,6 @@ variable "tags" {
2424
default = {}
2525
}
2626

27-
variable "client_id" {
28-
type = string
29-
description = "Azure client ID to use to manage Azure resources from the cluster, like f.e. load balancers"
30-
}
31-
32-
variable "client_secret" {
33-
type = string
34-
description = "Azure client secret to use to manage Azure resources from the cluster, like f.e. load balancers"
35-
}
36-
3727
variable "dns_prefix" {
3828
type = string
3929
description = "DNS-Prefix to use. Defaults to cluster name"
@@ -107,7 +97,7 @@ variable "node_pools" {
10797

10898
variable "load_balancer_sku" {
10999
description = "The SKU for the used Load Balancer"
110-
default = "Basic"
100+
default = "basic"
111101
}
112102

113103
variable "max_pods" {

0 commit comments

Comments
 (0)