Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove hardcoded values that are handled by the API #11423

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1207,9 +1207,6 @@ func buildDisks(d *schema.ResourceData, config *transport_tpg.Config) ([]*comput

// Build the disk
var disk compute.AttachedDisk
disk.Type = "PERSISTENT"
disk.Mode = "READ_WRITE"
disk.Interface = "SCSI"
disk.Boot = i == 0
disk.AutoDelete = d.Get(prefix + ".auto_delete").(bool)

Expand Down Expand Up @@ -1620,10 +1617,6 @@ func reorderDisks(configDisks []interface{}, apiDisks []map[string]interface{})
disksByDeviceName[v.(string)] = i
} else if v := disk["type"]; v.(string) == "SCRATCH" {
iface := disk["interface"].(string)
if iface == "" {
// apply-time default
iface = "SCSI"
}
scratchDisksByInterface[iface] = append(scratchDisksByInterface[iface], i)
} else if v := disk["source"]; v.(string) != "" {
attachedDisksBySource[v.(string)] = i
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ func TestComputeInstanceTemplate_reorderDisks(t *testing.T) {
cDeviceName := map[string]interface{}{
"device_name": "disk-1",
}
cScratch := map[string]interface{}{
"type": "SCRATCH",
cScratchScsi := map[string]interface{}{
"type": "SCRATCH",
"interface": "SCSI",
}
cSource := map[string]interface{}{
"source": "disk-source",
Expand Down Expand Up @@ -78,7 +79,7 @@ func TestComputeInstanceTemplate_reorderDisks(t *testing.T) {
aBoot, aScratchNvme, aSource, aScratchScsi, aFallThrough, aDeviceName,
},
ConfigDisks: []interface{}{
cBoot, cFallThrough, cDeviceName, cScratch, cSource, cScratchNvme,
cBoot, cFallThrough, cDeviceName, cScratchScsi, cSource, cScratchNvme,
},
ExpectedResult: []map[string]interface{}{
aBoot, aFallThrough, aDeviceName, aScratchScsi, aSource, aScratchNvme,
Expand All @@ -89,7 +90,7 @@ func TestComputeInstanceTemplate_reorderDisks(t *testing.T) {
aBoot, aNoMatch, aScratchNvme, aScratchScsi, aFallThrough, aDeviceName,
},
ConfigDisks: []interface{}{
cBoot, cFallThrough, cDeviceName, cScratch, cSource, cScratchNvme,
cBoot, cFallThrough, cDeviceName, cScratchScsi, cSource, cScratchNvme,
},
ExpectedResult: []map[string]interface{}{
aBoot, aFallThrough, aDeviceName, aScratchScsi, aScratchNvme, aNoMatch,
Expand All @@ -100,7 +101,7 @@ func TestComputeInstanceTemplate_reorderDisks(t *testing.T) {
aBoot, aScratchNvme, aFallThrough, aSource, aScratchScsi, aFallThrough2, aDeviceName,
},
ConfigDisks: []interface{}{
cBoot, cFallThrough, cDeviceName, cScratch, cFallThrough, cSource, cScratchNvme,
cBoot, cFallThrough, cDeviceName, cScratchScsi, cFallThrough, cSource, cScratchNvme,
},
ExpectedResult: []map[string]interface{}{
aBoot, aFallThrough, aDeviceName, aScratchScsi, aFallThrough2, aSource, aScratchNvme,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ func TestComputeRegionInstanceTemplate_reorderDisks(t *testing.T) {
cDeviceName := map[string]interface{}{
"device_name": "disk-1",
}
cScratch := map[string]interface{}{
cScratchScsi := map[string]interface{}{
"type": "SCRATCH",
"interface": "SCSI",
}
cSource := map[string]interface{}{
"source": "disk-source",
Expand Down Expand Up @@ -81,7 +82,7 @@ func TestComputeRegionInstanceTemplate_reorderDisks(t *testing.T) {
aBoot, aScratchNvme, aSource, aScratchScsi, aFallThrough, aDeviceName,
},
ConfigDisks: []interface{}{
cBoot, cFallThrough, cDeviceName, cScratch, cSource, cScratchNvme,
cBoot, cFallThrough, cDeviceName, cScratchScsi, cSource, cScratchNvme,
},
ExpectedResult: []map[string]interface{}{
aBoot, aFallThrough, aDeviceName, aScratchScsi, aSource, aScratchNvme,
Expand All @@ -92,7 +93,7 @@ func TestComputeRegionInstanceTemplate_reorderDisks(t *testing.T) {
aBoot, aNoMatch, aScratchNvme, aScratchScsi, aFallThrough, aDeviceName,
},
ConfigDisks: []interface{}{
cBoot, cFallThrough, cDeviceName, cScratch, cSource, cScratchNvme,
cBoot, cFallThrough, cDeviceName, cScratchScsi, cSource, cScratchNvme,
},
ExpectedResult: []map[string]interface{}{
aBoot, aFallThrough, aDeviceName, aScratchScsi, aScratchNvme, aNoMatch,
Expand All @@ -103,7 +104,7 @@ func TestComputeRegionInstanceTemplate_reorderDisks(t *testing.T) {
aBoot, aScratchNvme, aFallThrough, aSource, aScratchScsi, aFallThrough2, aDeviceName,
},
ConfigDisks: []interface{}{
cBoot, cFallThrough, cDeviceName, cScratch, cFallThrough, cSource, cScratchNvme,
cBoot, cFallThrough, cDeviceName, cScratchScsi, cFallThrough, cSource, cScratchNvme,
},
ExpectedResult: []map[string]interface{}{
aBoot, aFallThrough, aDeviceName, aScratchScsi, aFallThrough2, aSource, aScratchNvme,
Expand Down