Skip to content

Commit

Permalink
Pin Compute microversion to 2.67 when using block_device
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 aab928d
Show file tree
Hide file tree
Showing 2 changed files with 3 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
9 changes: 2 additions & 7 deletions openstack/resource_openstack_compute_instance_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -554,13 +554,8 @@ 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
}
}
// Some block_device parameters require microversion >=2.60
computeClient.Microversion = computeV2InstanceBlockDeviceMicroversion

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

0 comments on commit aab928d

Please sign in to comment.