Skip to content

Commit

Permalink
Pin Compute microver to 2.67 when using blockdevs
Browse files Browse the repository at this point in the history
Always pin Compute microversion to 2.67 when using block_device. This
solves terraform-provider-openstack#1057 while adhering to KISS priciple.
  • Loading branch information
ralgar committed Apr 9, 2023
1 parent 9a4d145 commit 3d32f53
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
2 changes: 1 addition & 1 deletion openstack/compute_instance_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const (
computeV2InstanceCreateServerWithNetworkModeMicroversion = "2.37"
computeV2InstanceCreateServerWithTagsMicroversion = "2.52"
computeV2TagsExtensionMicroversion = "2.26"
computeV2InstanceBlockDeviceVolumeTypeMicroversion = "2.67"
computeV2InstanceBlockDeviceMicroversion = "2.67"
)

// InstanceNIC is a structured representation of a Gophercloud servers.Server
Expand Down
8 changes: 1 addition & 7 deletions openstack/resource_openstack_compute_instance_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -554,13 +554,7 @@ func resourceComputeInstanceV2Create(ctx context.Context, d *schema.ResourceData
return diag.FromErr(err)
}

// Check if VolumeType was set in any of the Block Devices.
// If so, set the client's microversion appropriately.
for _, bd := range blockDevices {
if bd.VolumeType != "" {
computeClient.Microversion = computeV2InstanceBlockDeviceVolumeTypeMicroversion
}
}
computeClient.Microversion = computeV2InstanceBlockDeviceMicroversion

createOpts = &bootfromvolume.CreateOptsExt{
CreateOptsBuilder: createOpts,
Expand Down

0 comments on commit 3d32f53

Please sign in to comment.