Skip to content

Commit 61cf4da

Browse files
authored
Merge pull request #35 from tahoe-lafs/29.comment-users
Better comment for the definition of the users
2 parents 67392a2 + f0d5f4c commit 61cf4da

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

tf/core/users.tf

+10-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
# This file only list our user's email and public keys,
2-
# so those can be re-used elsewhere (e.g.: hcloud, gandi, ...)
1+
# This file is where we define all our users and their attributes (e.g.: email, keys, ...),
2+
# so those can be re-used with different providers (e.g.: aws, hcloud, gandi, ...)
33
locals {
44
users = {
55
benoit = {
66
email = "benoit@leastauthority.com",
77
ssh_keys = [
88
{
9-
id = "000619776016",
9+
id = "000619776016", # could be anything, but unique per user
1010
key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIZtWY7t8HVnaz6bluYsrAlzZC3MZtb8g0nO5L5fCQKR benoit@leastauthority.com",
1111
},
1212
],
@@ -15,14 +15,17 @@ locals {
1515
email = "florian@leastauthority.com",
1616
ssh_keys = [
1717
{
18-
id = "000018054987",
18+
id = "000018054987", # could be anything, but unique per user
1919
key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJlPneIaRT/mqu13N83ctEftub4O6zAfi6qgzZKerU5o florian@leastauthority.com",
2020
},
2121
],
2222
},
2323
}
2424

25-
# Flatten all the ssh keys of each users
25+
# In many cases, the ssh keys from all the users above will be authorized to access some ressources
26+
# (e.g.: a new server). So we better collect all the ssh keys together in a local variable,
27+
# and give them a unique name (e.g.: one username with multiple keys)
28+
#
2629
ssh_keys = flatten([
2730
for username, values in local.users : [
2831
for v in values.ssh_keys : {
@@ -33,7 +36,8 @@ locals {
3336
])
3437
}
3538

36-
# Manage ssh keys
39+
# Now we have all the ssh keys of all our users, we can deploy and manage them
40+
# so Hetzner can use to provision our resources (e.g.: new VPS)
3741
resource "hcloud_ssh_key" "ssh_keys" {
3842
for_each = {
3943
for key in local.ssh_keys : "tf-${key.name}" => key.public_key

0 commit comments

Comments
 (0)