Skip to content

Commit 79ddf1a

Browse files
committed
fix: mountpoint size can't be changed right now, so they should trigger a recreate
Signed-off-by: Alexander Petermann <[email protected]>
1 parent cdbf94f commit 79ddf1a

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

proxmoxtf/resource/container/container.go

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -662,6 +662,7 @@ func Container() *schema.Resource {
662662
Type: schema.TypeList,
663663
Description: "A mount point",
664664
Optional: true,
665+
ForceNew: true,
665666
Elem: &schema.Resource{
666667
Schema: map[string]*schema.Schema{
667668
mkMountPointACL: {
@@ -721,12 +722,14 @@ func Container() *schema.Resource {
721722
Description: "Volume size (only used for volume mount points)",
722723
Optional: true,
723724
Default: dvMountPointSize,
725+
ForceNew: true,
724726
ValidateDiagFunc: validators.FileSize(),
725727
},
726728
mkMountPointVolume: {
727729
Type: schema.TypeString,
728730
Description: "Volume, device or directory to mount into the container",
729731
Required: true,
732+
ForceNew: true,
730733
DiffSuppressFunc: func(_, oldVal, newVal string, _ *schema.ResourceData) bool {
731734
// For *new* volume mounts PVE returns an actual volume ID which is saved in the stare,
732735
// so on reapply the provider will try override it:"
@@ -1038,8 +1041,6 @@ func Container() *schema.Resource {
10381041
newList = []interface{}{}
10391042
}
10401043

1041-
// fmt.Printf("ALEX: ALL DISK: old: %v ---- new: %v\n", old, new)
1042-
10431044
minDrives := min(len(oldList), len(newList))
10441045

10451046
for i := range minDrives {
@@ -1061,12 +1062,9 @@ func Container() *schema.Resource {
10611062
}
10621063
}
10631064

1064-
// fmt.Printf("ALEX: check DISK %v: %v vs %v\n", i, oldSize, newSize)
10651065
if oldSize > newSize {
1066-
1067-
// fmt.Print("ALEX: check DISK: new is smaller\n")
10681066
_ = d.ForceNew(fmt.Sprintf("%s.%d.%s", mkDisk, i, mkDiskSize))
1069-
return true // <-- this is not working
1067+
return true
10701068
}
10711069
}
10721070

@@ -3060,7 +3058,7 @@ func containerUpdate(ctx context.Context, d *schema.ResourceData, m interface{})
30603058
return diag.Errorf("New disk size (%s) has to be greater the current disk (%s)!", oldSize, size)
30613059
}
30623060

3063-
if oldSize != size {
3061+
if !ptr.Eq(oldSize, size) {
30643062
err = containerAPI.ResizeContainerDisk(ctx, &containers.ResizeRequestBody{
30653063
Disk: "rootfs",
30663064
Size: size.String(),

0 commit comments

Comments
 (0)