fix: Add user for GitHub Actions

This commit is contained in:
2025-08-02 20:41:36 +02:00
parent 76acc6e772
commit ece3a51097
5 changed files with 16 additions and 0 deletions
+1
View File
@@ -135,6 +135,7 @@ module "test_swarm_cluster" {
admin_user = "2martensAdmin" admin_user = "2martensAdmin"
terraform_public_ssh_key = var.terraform_public_ssh_key terraform_public_ssh_key = var.terraform_public_ssh_key
terraform_private_ssh_key = var.terraform_private_ssh_key terraform_private_ssh_key = var.terraform_private_ssh_key
github_public_ssh_key = var.github_public_ssh_key
basic_firewall_id = hcloud_firewall.basic-firewall.id basic_firewall_id = hcloud_firewall.basic-firewall.id
domain = local.domain domain = local.domain
locations = [ locations = [
@@ -74,6 +74,7 @@ resource "hcloud_server" "node" {
admin_public_ssh_key : format("%s %s", var.admin_ssh_key.public_key, var.admin_ssh_key.name) admin_public_ssh_key : format("%s %s", var.admin_ssh_key.public_key, var.admin_ssh_key.name)
admin_user : var.admin_user admin_user : var.admin_user
terraform_public_ssh_key : var.terraform_public_ssh_key terraform_public_ssh_key : var.terraform_public_ssh_key
github_public_ssh_key : var.github_public_ssh_key
main_node : count.index == 0 main_node : count.index == 0
packages_setup : base64encode(file("${path.module}/templates/scripts/install-packages.sh")) packages_setup : base64encode(file("${path.module}/templates/scripts/install-packages.sh"))
firewall_setup : base64encode(templatefile("${path.module}/templates/scripts/firewall-setup.sh.tftpl", { firewall_setup : base64encode(templatefile("${path.module}/templates/scripts/firewall-setup.sh.tftpl", {
@@ -11,6 +11,10 @@ users:
sudo: ALL=(ALL) NOPASSWD:ALL sudo: ALL=(ALL) NOPASSWD:ALL
ssh_authorized_keys: ssh_authorized_keys:
- ${terraform_public_ssh_key} - ${terraform_public_ssh_key}
- name: github
groups: users, docker
ssh_authorized_keys:
- ${github_public_ssh_key}
package_update: true package_update: true
package_upgrade: true package_upgrade: true
package_reboot_if_required: true package_reboot_if_required: true
@@ -23,6 +23,11 @@ variable "terraform_public_ssh_key" {
type = string type = string
} }
variable "github_public_ssh_key" {
description = "Public SSH key for the private key used by GitHub Actions to connect with remote machines"
type = string
}
variable "locations" { variable "locations" {
description = "Locations in which the resources should be created. Singular resources will always be created in the first. Must be all in the same network zone." description = "Locations in which the resources should be created. Singular resources will always be created in the first. Must be all in the same network zone."
type = list(object({ type = list(object({
+5
View File
@@ -49,6 +49,11 @@ variable "terraform_public_ssh_key" {
type = string type = string
} }
variable "github_public_ssh_key" {
description = "Public SSH key for the private key used by GitHub Actions to connect with remote machines"
type = string
}
variable "vault_client_id" { variable "vault_client_id" {
description = "Client ID of the service principal used to access Hashicorp Cloud" description = "Client ID of the service principal used to access Hashicorp Cloud"
type = string type = string