mirror of
https://github.com/bpg/terraform-provider-proxmox.git
synced 2025-06-30 02:31:10 +00:00
feat(lxc): add support for the start_on_boot
option (#605)
* feat(lxc): add support for the `start_on_boot` option Signed-off-by: Simon Caron <simon.caron.8@gmail.com> * Move code next to started blocks + update default value Signed-off-by: Simon Caron <simon.caron.8@gmail.com> --------- Signed-off-by: Simon Caron <simon.caron.8@gmail.com> Co-authored-by: Simon Caron <simon.caron.8@gmail.com>
This commit is contained in:
parent
c44e93a9f1
commit
d36cf4eab8
@ -188,6 +188,7 @@ output "ubuntu_container_public_key" {
|
||||
- `unmanaged` - Unmanaged.
|
||||
- `pool_id` - (Optional) The identifier for a pool to assign the container to.
|
||||
- `started` - (Optional) Whether to start the container (defaults to `true`).
|
||||
- `start_on_boot` - (Optional) Automatically start container when the host system boots (defaults to `true`).
|
||||
- `tags` - (Optional) A list of tags the container tags. This is only meta
|
||||
information (defaults to `[]`). Note: Proxmox always sorts the container tags.
|
||||
If the list in template is not sorted, then Proxmox will always report a
|
||||
|
@ -65,6 +65,7 @@ const (
|
||||
dvResourceVirtualEnvironmentContainerOperatingSystemType = "unmanaged"
|
||||
dvResourceVirtualEnvironmentContainerPoolID = ""
|
||||
dvResourceVirtualEnvironmentContainerStarted = true
|
||||
dvResourceVirtualEnvironmentContainerStartOnBoot = true
|
||||
dvResourceVirtualEnvironmentContainerTemplate = false
|
||||
dvResourceVirtualEnvironmentContainerUnprivileged = false
|
||||
dvResourceVirtualEnvironmentContainerVMID = -1
|
||||
@ -135,6 +136,7 @@ const (
|
||||
mkResourceVirtualEnvironmentContainerOperatingSystemType = "type"
|
||||
mkResourceVirtualEnvironmentContainerPoolID = "pool_id"
|
||||
mkResourceVirtualEnvironmentContainerStarted = "started"
|
||||
mkResourceVirtualEnvironmentContainerStartOnBoot = "start_on_boot"
|
||||
mkResourceVirtualEnvironmentContainerTags = "tags"
|
||||
mkResourceVirtualEnvironmentContainerTemplate = "template"
|
||||
mkResourceVirtualEnvironmentContainerUnprivileged = "unprivileged"
|
||||
@ -717,6 +719,13 @@ func Container() *schema.Resource {
|
||||
return d.Get(mkResourceVirtualEnvironmentContainerTemplate).(bool)
|
||||
},
|
||||
},
|
||||
mkResourceVirtualEnvironmentContainerStartOnBoot: {
|
||||
Type: schema.TypeBool,
|
||||
Description: "Automatically start container when the host system boots.",
|
||||
Optional: true,
|
||||
ForceNew: false,
|
||||
Default: dvResourceVirtualEnvironmentContainerStartOnBoot,
|
||||
},
|
||||
mkResourceVirtualEnvironmentContainerTags: {
|
||||
Type: schema.TypeList,
|
||||
Description: "Tags of the container. This is only meta information.",
|
||||
@ -1448,6 +1457,7 @@ func containerCreateCustom(ctx context.Context, d *schema.ResourceData, m interf
|
||||
|
||||
poolID := d.Get(mkResourceVirtualEnvironmentContainerPoolID).(string)
|
||||
started := types.CustomBool(d.Get(mkResourceVirtualEnvironmentContainerStarted).(bool))
|
||||
startOnBoot := types.CustomBool(d.Get(mkResourceVirtualEnvironmentContainerStartOnBoot).(bool))
|
||||
tags := d.Get(mkResourceVirtualEnvironmentContainerTags).([]interface{})
|
||||
template := types.CustomBool(d.Get(mkResourceVirtualEnvironmentContainerTemplate).(bool))
|
||||
unprivileged := types.CustomBool(d.Get(mkResourceVirtualEnvironmentContainerUnprivileged).(bool))
|
||||
@ -1477,7 +1487,8 @@ func containerCreateCustom(ctx context.Context, d *schema.ResourceData, m interf
|
||||
OSTemplateFileVolume: &operatingSystemTemplateFileID,
|
||||
OSType: &operatingSystemType,
|
||||
RootFS: rootFS,
|
||||
StartOnBoot: &started,
|
||||
Start: &started,
|
||||
StartOnBoot: &startOnBoot,
|
||||
Swap: &memorySwap,
|
||||
Template: &template,
|
||||
TTY: &consoleTTYCount,
|
||||
|
@ -47,6 +47,7 @@ func TestContainerSchema(t *testing.T) {
|
||||
mkResourceVirtualEnvironmentContainerTags,
|
||||
mkResourceVirtualEnvironmentContainerTemplate,
|
||||
mkResourceVirtualEnvironmentContainerUnprivileged,
|
||||
mkResourceVirtualEnvironmentContainerStartOnBoot,
|
||||
mkResourceVirtualEnvironmentContainerFeatures,
|
||||
mkResourceVirtualEnvironmentContainerVMID,
|
||||
})
|
||||
@ -64,6 +65,7 @@ func TestContainerSchema(t *testing.T) {
|
||||
mkResourceVirtualEnvironmentContainerTags: schema.TypeList,
|
||||
mkResourceVirtualEnvironmentContainerTemplate: schema.TypeBool,
|
||||
mkResourceVirtualEnvironmentContainerUnprivileged: schema.TypeBool,
|
||||
mkResourceVirtualEnvironmentContainerStartOnBoot: schema.TypeBool,
|
||||
mkResourceVirtualEnvironmentContainerFeatures: schema.TypeList,
|
||||
mkResourceVirtualEnvironmentContainerVMID: schema.TypeInt,
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user