Skip to content

Commit

Permalink
Make k3s token as non-sensitive value
Browse files Browse the repository at this point in the history
In order to have more information during provisionning, I make this
token as non-sensitive value. This didn't have any issue on security
because it is never showed on logs.
  • Loading branch information
xunleii committed Nov 11, 2023
1 parent 3791d3f commit ab545ba
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion agent_nodes.tf
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ locals {
"--node-ip ${agent.ip}",
"--node-name '${try(agent.name, key)}'",
"--server https://${local.root_advertise_ip_k3s}:6443",
"--token ${random_password.k3s_cluster_secret.result}",
"--token ${nonsensitive(random_password.k3s_cluster_secret.result)}", # NOTE: nonsensitive is used to show logs during provisioning
],
var.global_flags,
try(agent.flags, []),
Expand Down
4 changes: 2 additions & 2 deletions server_nodes.tf
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ locals {
"--cluster-domain '${var.cluster_domain}'",
"--cluster-cidr ${var.cidr.pods}",
"--service-cidr ${var.cidr.services}",
"--token ${random_password.k3s_cluster_secret.result}",
"--token ${nonsensitive(random_password.k3s_cluster_secret.result)}", # NOTE: nonsensitive is used to show logs during provisioning
length(var.servers) > 1 ? "--cluster-init" : "",
] :
// For other server nodes, use agent flags (because the first node manage the cluster configuration)
Expand All @@ -105,7 +105,7 @@ locals {
"--cluster-domain '${var.cluster_domain}'",
"--cluster-cidr ${var.cidr.pods}",
"--service-cidr ${var.cidr.services}",
"--token ${random_password.k3s_cluster_secret.result}",
"--token ${nonsensitive(random_password.k3s_cluster_secret.result)}", # NOTE: nonsensitive is used to show logs during provisioning
],
var.global_flags,
try(server.flags, []),
Expand Down

0 comments on commit ab545ba

Please sign in to comment.