Skip to content

Commit c7efdaf

Browse files
committed
use suggestions
1 parent 40a52b6 commit c7efdaf

File tree

2 files changed

+8
-19
lines changed

2 files changed

+8
-19
lines changed

main.tf

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,9 @@ locals {
1515
tailscale_set_extra_flags_enabled = length(var.tailscale_set_extra_flags) > 0
1616

1717
userdata = templatefile("${path.module}/userdata.sh.tmpl", {
18-
authkey = try(
19-
coalesce(
20-
one(tailscale_oauth_client.default[*].key),
21-
one(tailscale_tailnet_key.default[*].key),
22-
),
23-
null
18+
authkey = coalesce(
19+
one(tailscale_oauth_client.default[*].key),
20+
one(tailscale_tailnet_key.default[*].key),
2421
)
2522
exit_node_enabled = var.exit_node_enabled
2623
hostname = module.this.id

variables.tf

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -205,10 +205,10 @@ variable "advertise_routes" {
205205
variable "authkey_config" {
206206
default = {
207207
"tailscale_tailnet_key" = {
208-
"ephemeral": false,
209-
"expiry": 7776000,
210-
"preauthorized": true,
211-
"reusable" = true,
208+
"ephemeral" = false,
209+
"expiry" = 7776000,
210+
"preauthorized" = true,
211+
"reusable" = true,
212212
}
213213
}
214214

@@ -239,20 +239,12 @@ variable "authkey_config" {
239239
}))
240240
})
241241

242-
validation {
243-
condition = (
244-
var.authkey_config.tailscale_oauth_client != null ||
245-
var.authkey_config.tailscale_tailnet_key != null
246-
)
247-
error_message = "At least one of 'tailscale_oauth_client' or 'tailscale_tailnet_key' must be defined in authkey_config."
248-
}
249-
250242
validation {
251243
condition = (
252244
var.authkey_config.tailscale_oauth_client == null && var.authkey_config.tailscale_tailnet_key != null ||
253245
var.authkey_config.tailscale_oauth_client != null && var.authkey_config.tailscale_tailnet_key == null
254246
)
255-
error_message = "Only one of 'tailscale_oauth_client' or 'tailscale_tailnet_key' must be defined in authkey_config."
247+
error_message = "Exactly one of 'tailscale_oauth_client' or 'tailscale_tailnet_key' must be defined in authkey_config."
256248
}
257249

258250
validation {

0 commit comments

Comments
 (0)