mirror of
https://github.com/bpg/terraform-provider-proxmox.git
synced 2025-07-02 03:22:59 +00:00
fix(lxc): use default rootfs size (4Gb) prevents creation of mount points (#1398)
Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
This commit is contained in:
parent
cc7fc63ec1
commit
4a8bf8da27
@ -5,7 +5,7 @@ resource "proxmox_virtual_environment_container" "example_template" {
|
||||
|
||||
disk {
|
||||
datastore_id = element(data.proxmox_virtual_environment_datastores.example.datastore_ids, index(data.proxmox_virtual_environment_datastores.example.datastore_ids, "local-lvm"))
|
||||
size = 10
|
||||
size = 4
|
||||
}
|
||||
|
||||
mount_point {
|
||||
|
@ -67,7 +67,13 @@ resource "proxmox_virtual_environment_container" "test_container" {
|
||||
|
||||
disk {
|
||||
datastore_id = "local-lvm"
|
||||
size = 8
|
||||
size = 4
|
||||
}
|
||||
|
||||
mount_point {
|
||||
volume = "local-lvm"
|
||||
size = "4G"
|
||||
path = "mnt/local"
|
||||
}
|
||||
|
||||
description = <<-EOT
|
||||
|
@ -1384,17 +1384,6 @@ func containerCreateCustom(ctx context.Context, d *schema.ResourceData, m interf
|
||||
|
||||
diskDatastoreID := diskBlock[mkDiskDatastoreID].(string)
|
||||
|
||||
var rootFS *containers.CustomRootFS
|
||||
|
||||
diskSize := diskBlock[mkDiskSize].(int)
|
||||
if diskSize != dvDiskSize && diskDatastoreID != "" {
|
||||
// This is a special case where the rootfs size is set to a non-default value at creation time.
|
||||
// see https://pve.proxmox.com/pve-docs/chapter-pct.html#_storage_backed_mount_points
|
||||
rootFS = &containers.CustomRootFS{
|
||||
Volume: fmt.Sprintf("%s:%d", diskDatastoreID, diskSize),
|
||||
}
|
||||
}
|
||||
|
||||
features, err := containerGetFeatures(container, d)
|
||||
if err != nil {
|
||||
return diag.FromErr(err)
|
||||
@ -1594,6 +1583,17 @@ func containerCreateCustom(ctx context.Context, d *schema.ResourceData, m interf
|
||||
mountPointArray = append(mountPointArray, mountPointObject)
|
||||
}
|
||||
|
||||
var rootFS *containers.CustomRootFS
|
||||
|
||||
diskSize := diskBlock[mkDiskSize].(int)
|
||||
if diskDatastoreID != "" && (diskSize != dvDiskSize || len(mountPointArray) > 0) {
|
||||
// This is a special case where the rootfs size is set to a non-default value at creation time.
|
||||
// see https://pve.proxmox.com/pve-docs/chapter-pct.html#_storage_backed_mount_points
|
||||
rootFS = &containers.CustomRootFS{
|
||||
Volume: fmt.Sprintf("%s:%d", diskDatastoreID, diskSize),
|
||||
}
|
||||
}
|
||||
|
||||
networkInterface := d.Get(mkNetworkInterface).([]interface{})
|
||||
networkInterfaceArray := make(containers.CustomNetworkInterfaceArray, len(networkInterface))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user