Skip to content

Commit

Permalink
Fix issue when DiskType is not set
Browse files Browse the repository at this point in the history
  • Loading branch information
fabi200123 committed Sep 24, 2024
1 parent e9fe6e8 commit b06d2c4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion internal/client/gcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,6 @@ func generateBootDisk(diskSize int64, image, snapshot string, diskType string, c
Boot: proto.Bool(true),
InitializeParams: &computepb.AttachedDiskInitializeParams{
DiskSizeGb: proto.Int64(diskSize),
DiskType: proto.String(diskType),
Labels: customLabels,
SourceImage: proto.String(image),
SourceSnapshot: proto.String(snapshot),
Expand All @@ -333,6 +332,10 @@ func generateBootDisk(diskSize int64, image, snapshot string, diskType string, c
},
}

if diskType != "" {
disk[0].InitializeParams.DiskType = proto.String(diskType)
}

if snapshot != "" {
disk[0].InitializeParams.SourceImage = nil
}
Expand Down

0 comments on commit b06d2c4

Please sign in to comment.