From 48451c67176192f4e75b0b8929d0b48a04926372 Mon Sep 17 00:00:00 2001 From: ManInDark <61268856+ManInDark@users.noreply.github.com> Date: Sat, 14 Feb 2026 20:59:42 +0100 Subject: [PATCH] feat(LXC): add ssh-keys --- lxc.go | 14 ++++++++------ schema/pkl/proxmox.pkl | 3 +++ types.go | 17 +++++++++-------- 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/lxc.go b/lxc.go index 1186ad2..3f68cf1 100644 --- a/lxc.go +++ b/lxc.go @@ -8,6 +8,7 @@ import ( "net/http" "net/url" "strconv" + "strings" "github.com/platform-engineering-labs/formae/pkg/plugin/resource" ) @@ -67,12 +68,13 @@ func (p *Plugin) CreateLXC(ctx context.Context, req *resource.CreateRequest) (*r } urlparams := url.Values{ - "vmid": {props.VMID}, - "ostemplate": {props.OSTemplate}, - "password": {props.Password}, - "hostname": {props.Hostname}, - "cores": {strconv.Itoa(props.Cores)}, - "memory": {strconv.Itoa(props.Memory)}, + "vmid": {props.VMID}, + "ostemplate": {props.OSTemplate}, + "password": {props.Password}, + "hostname": {props.Hostname}, + "cores": {strconv.Itoa(props.Cores)}, + "memory": {strconv.Itoa(props.Memory)}, + "ssh-public-keys": {strings.Join(props.SSHKeys, "\n")}, } if props.Description != "" { urlparams.Add("description", props.Description) diff --git a/schema/pkl/proxmox.pkl b/schema/pkl/proxmox.pkl index cd06cf5..ad0b068 100644 --- a/schema/pkl/proxmox.pkl +++ b/schema/pkl/proxmox.pkl @@ -46,4 +46,7 @@ class LXC extends formae.Resource { @formae.FieldHint {} onboot: Int = 0 + @formae.FieldHint {} + sshkeys: Listing? + } diff --git a/types.go b/types.go index eecc449..9b06965 100644 --- a/types.go +++ b/types.go @@ -8,14 +8,15 @@ type TargetConfig struct { } type LXCProperties struct { - VMID string `json:"vmid"` - Hostname string `json:"hostname"` - Description string `json:"description,omitempty"` - OSTemplate string `json:"ostemplate,omitempty"` - Password string `json:"password,omitempty"` - Cores int `json:"cores"` - Memory int `json:"memory"` - OnBoot int `json:"onboot"` + VMID string `json:"vmid"` + Hostname string `json:"hostname"` + Description string `json:"description,omitempty"` + OSTemplate string `json:"ostemplate,omitempty"` + Password string `json:"password,omitempty"` + Cores int `json:"cores"` + Memory int `json:"memory"` + OnBoot int `json:"onboot"` + SSHKeys []string `json:"sshkeys"` } type ReadRequest struct {