Skip to content

Commit 5c1a490

Browse files
dploegerDennis Ploeger
authored andcommitted
feat: Make ssh usage optional
1 parent 5e144d8 commit 5c1a490

File tree

3 files changed

+16
-10
lines changed

3 files changed

+16
-10
lines changed

README.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,6 @@ Description: Azure Resource Group to use
108108

109109
Type: `string`
110110

111-
### ssh\_public\_key
112-
113-
Description: SSH public key to access the kubernetes node with
114-
115-
Type: `string`
116-
117111
### stage
118112

119113
Description: Stage for this ip
@@ -269,6 +263,14 @@ Type: `string`
269263

270264
Default: `"Free"`
271265

266+
### ssh\_public\_key
267+
268+
Description: SSH public key to access the kubernetes node with
269+
270+
Type: `string`
271+
272+
Default: `""`
273+
272274
### static\_outbound\_ip\_count
273275

274276
Description: On a lot of outgoing connections use this together with the maximum for outbound\_ports\_allocated of 64000 to not fall into network

main.tf

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,13 @@ resource "azurerm_kubernetes_cluster" "k8s" {
6868
}
6969
}
7070

71-
linux_profile {
72-
admin_username = var.project
73-
ssh_key {
74-
key_data = var.ssh_public_key
71+
dynamic "linux_profile" {
72+
for_each = var.ssh_public_key == "" ? [] : [var.ssh_public_key]
73+
content {
74+
admin_username = var.project
75+
ssh_key {
76+
key_data = linux_profile.value
77+
}
7578
}
7679
}
7780
}

vars.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ variable "idle_timeout" {
159159

160160
variable "ssh_public_key" {
161161
type = string
162+
default = ""
162163
description = "SSH public key to access the kubernetes node with"
163164
}
164165

0 commit comments

Comments
 (0)