You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Check if there are any new volumes being attached
547
+
for_, newVolume:=rangenewVolumeList {
548
+
newVolumeData:=newVolume.(map[string]interface{})
549
+
found:=false
550
+
for_, oldVolume:=rangeoldVolumeList {
551
+
oldVolumeData:=oldVolume.(map[string]interface{})
552
+
ifnewVolumeData["id"] ==oldVolumeData["id"] {
553
+
found=true
554
+
break
555
+
}
556
+
}
557
+
if!found {
558
+
// This is a new volume being attached, which is not allowed
559
+
returndiag.Errorf("Attaching new volumes after instance creation is not allowed. Please create a new civo_volume_attachment resource for attaching additional volume.")
560
+
}
561
+
}
562
+
563
+
// Handle volume detachments
564
+
for_, oldVolume:=rangeoldVolumeList {
565
+
oldVolumeData:=oldVolume.(map[string]interface{})
566
+
found:=false
567
+
for_, newVolume:=rangenewVolumeList {
568
+
newVolumeData:=newVolume.(map[string]interface{})
569
+
ifoldVolumeData["id"] ==newVolumeData["id"] {
570
+
found=true
571
+
break
572
+
}
573
+
}
574
+
if!found {
575
+
// This volume is no longer in the config, so detach it
0 commit comments