Skip to content

Commit

Permalink
remove user info
Browse files Browse the repository at this point in the history
  • Loading branch information
maxi418 committed Feb 22, 2024
1 parent 81d0d5c commit df8e389
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 7 deletions.
1 change: 0 additions & 1 deletion modules/ionos-basic-vm/keys/technicaluser.pub

This file was deleted.

6 changes: 3 additions & 3 deletions modules/ionos-basic-vm/locals.tf
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
locals {
technicaluser_key_path = "${path.module}/keys/technicaluser.pub"

public_ip = var.create_ip_pool ? ionoscloud_ipblock.public_ip[0].ips[0] : var.public_ip
dns_zone_name = var.dns_zone_name_override == "" ? module.conventions_coordinates.dns_zone_name : var.dns_zone_name_override
basic_vm_server = var.permanent_vm ? ionoscloud_server.basic_vm_server[0] : ionoscloud_server.basic_vm_server_not_permanent[0]

user_data_vars = {
"technicaluser_public_key" = file(local.technicaluser_key_path)
"initial_user" = var.initial_user
"initial_uid" = var.initial_uid
"initial_public_key" = var.initial_public_key
}
user_data = base64encode(templatefile("${path.module}/${var.user_data_script}", local.user_data_vars))
}
6 changes: 3 additions & 3 deletions modules/ionos-basic-vm/user-data-cloud-init.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ runcmd:
- sed -i 's/HISTFILESIZE=2000/HISTFILESIZE=20000/g' /root/.bashrc

users:
- name: technicaluser
- name: ${initial_user}
sudo: ALL=(ALL:ALL) NOPASSWD:ALL
# uid must match the uid of the technical user in infra-schulcloud/ansible/group_vars/all/users.yml variable present_users
uid: "2215"
uid: ${initial_uid}
ssh_authorized_keys:
- ${technicaluser_public_key}
- ${initial_public_key}
18 changes: 18 additions & 0 deletions modules/ionos-basic-vm/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,24 @@ variable "user_data_script" {
default = "user-data-cloud-init.tpl"
}

variable "initial_user" {
type = string
description = "The initial user to be created via the cloud init script."
default = ""
}

variable "initial_uid" {
type = string
description = "The uid of the initial user created via the cloud init script."
default = ""
}

variable "initial_public_key" {
type = string
description = "The public key of the initial user created via the cloud init script."
default = ""
}

variable "availability_zone" {
type = string
description = "Possible Zones: AUTO, ZONE_1, ZONE_2"
Expand Down

0 comments on commit df8e389

Please sign in to comment.