diff --git a/lxc.go b/lxc.go index 1a8189b..0319ff9 100644 --- a/lxc.go +++ b/lxc.go @@ -69,6 +69,7 @@ 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)}, diff --git a/proxmox_test.go b/proxmox_test.go index 1b3fab2..c1f56c9 100644 --- a/proxmox_test.go +++ b/proxmox_test.go @@ -31,6 +31,7 @@ func TestCreate(t *testing.T) { "hostname": "testlxc", "description": "none", "ostemplate": "local:vztmpl/alpine-3.22-default_20250617_amd64.tar.xz", + "password": "password", "cores": 1, "memory": 512, } diff --git a/schema/pkl/proxmox.pkl b/schema/pkl/proxmox.pkl index 172b8ea..cd06cf5 100644 --- a/schema/pkl/proxmox.pkl +++ b/schema/pkl/proxmox.pkl @@ -28,6 +28,9 @@ class LXC extends formae.Resource { @formae.FieldHint {} ostemplate: String? + @formae.FieldHint {} + password: String? + @formae.FieldHint {} hostname: String diff --git a/testdata/resource-replace.pkl b/testdata/resource-replace.pkl index 348dd38..760c6e3 100644 --- a/testdata/resource-replace.pkl +++ b/testdata/resource-replace.pkl @@ -31,6 +31,7 @@ forma { hostname = "test-lxc" description = "some other description" ostemplate = "local:vztmpl/alpine-3.22-default_20250617_amd64.tar.xz" + password = "test" cores = 1 memory = 512 } diff --git a/testdata/resource.pkl b/testdata/resource.pkl index 23e97f9..7883e89 100644 --- a/testdata/resource.pkl +++ b/testdata/resource.pkl @@ -33,6 +33,7 @@ forma { hostname = "test-lxc" description = "no description provided" ostemplate = "local:vztmpl/alpine-3.22-default_20250617_amd64.tar.xz" + password = "abcd" cores = 1 memory = 512 } diff --git a/types.go b/types.go index b85f29b..eecc449 100644 --- a/types.go +++ b/types.go @@ -12,6 +12,7 @@ type LXCProperties struct { 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"`