@@ -53,6 +53,7 @@ func ResourceVolume() *schema.Resource {
5353 "snapshot_id" : {
5454 Type : schema .TypeString ,
5555 Optional : true ,
56+ ForceNew : true ,
5657 Description : "The snapshot to create the volume from" ,
5758 DiffSuppressFunc : dsf .Locality ,
5859 },
@@ -76,8 +77,8 @@ func ResourceVolume() *schema.Resource {
7677 "project_id" : account .ProjectIDSchema (),
7778 },
7879 CustomizeDiff : customdiff .All (
79- customDiffCannotShrink ("size_in_gb" ),
8080 customDiffSnapshot ("snapshot_id" ),
81+ customDiffCannotShrink ("size_in_gb" ),
8182 ),
8283 }
8384}
@@ -170,8 +171,11 @@ func ResourceBlockVolumeRead(ctx context.Context, d *schema.ResourceData, m any)
170171 _ = d .Set ("zone" , volume .Zone )
171172 _ = d .Set ("project_id" , volume .ProjectID )
172173 _ = d .Set ("tags" , volume .Tags )
173-
174- if volume .ParentSnapshotID != nil {
174+ _ , err = api .GetSnapshot (& block.GetSnapshotRequest {
175+ SnapshotID : * volume .ParentSnapshotID ,
176+ Zone : zone ,
177+ })
178+ if volume .ParentSnapshotID != nil && ! httperrors .Is403 (err ) && ! httperrors .Is404 (err ) {
175179 _ = d .Set ("snapshot_id" , zonal .NewIDString (zone , * volume .ParentSnapshotID ))
176180 } else {
177181 _ = d .Set ("snapshot_id" , "" )
0 commit comments