Merge pull request #1726 from skfmu/f-openstack-add-availability-zones
provider/openstack: Add availability zones for OpenStack block storage
This commit is contained in:
commit
136402afe9
|
@ -43,6 +43,11 @@ func resourceBlockStorageVolumeV1() *schema.Resource {
|
||||||
Optional: true,
|
Optional: true,
|
||||||
ForceNew: false,
|
ForceNew: false,
|
||||||
},
|
},
|
||||||
|
"availability_zone": &schema.Schema{
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Optional: true,
|
||||||
|
ForceNew: true,
|
||||||
|
},
|
||||||
"metadata": &schema.Schema{
|
"metadata": &schema.Schema{
|
||||||
Type: schema.TypeMap,
|
Type: schema.TypeMap,
|
||||||
Optional: true,
|
Optional: true,
|
||||||
|
@ -101,14 +106,15 @@ func resourceBlockStorageVolumeV1Create(d *schema.ResourceData, meta interface{}
|
||||||
}
|
}
|
||||||
|
|
||||||
createOpts := &volumes.CreateOpts{
|
createOpts := &volumes.CreateOpts{
|
||||||
Description: d.Get("description").(string),
|
Description: d.Get("description").(string),
|
||||||
Name: d.Get("name").(string),
|
Availability: d.Get("availability_zone").(string),
|
||||||
Size: d.Get("size").(int),
|
Name: d.Get("name").(string),
|
||||||
SnapshotID: d.Get("snapshot_id").(string),
|
Size: d.Get("size").(int),
|
||||||
SourceVolID: d.Get("source_vol_id").(string),
|
SnapshotID: d.Get("snapshot_id").(string),
|
||||||
ImageID: d.Get("image_id").(string),
|
SourceVolID: d.Get("source_vol_id").(string),
|
||||||
VolumeType: d.Get("volume_type").(string),
|
ImageID: d.Get("image_id").(string),
|
||||||
Metadata: resourceContainerMetadataV2(d),
|
VolumeType: d.Get("volume_type").(string),
|
||||||
|
Metadata: resourceContainerMetadataV2(d),
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Printf("[DEBUG] Create Options: %#v", createOpts)
|
log.Printf("[DEBUG] Create Options: %#v", createOpts)
|
||||||
|
@ -160,6 +166,7 @@ func resourceBlockStorageVolumeV1Read(d *schema.ResourceData, meta interface{})
|
||||||
|
|
||||||
d.Set("size", v.Size)
|
d.Set("size", v.Size)
|
||||||
d.Set("description", v.Description)
|
d.Set("description", v.Description)
|
||||||
|
d.Set("availability_zone", v.AvailabilityZone)
|
||||||
d.Set("name", v.Name)
|
d.Set("name", v.Name)
|
||||||
d.Set("snapshot_id", v.SnapshotID)
|
d.Set("snapshot_id", v.SnapshotID)
|
||||||
d.Set("source_vol_id", v.SourceVolID)
|
d.Set("source_vol_id", v.SourceVolID)
|
||||||
|
|
|
@ -38,6 +38,9 @@ The following arguments are supported:
|
||||||
* `description` - (Optional) A description of the volume. Changing this updates
|
* `description` - (Optional) A description of the volume. Changing this updates
|
||||||
the volume's description.
|
the volume's description.
|
||||||
|
|
||||||
|
* `availability_zone` - (Optional) The availability zone for the volume.
|
||||||
|
Changing this creates a new volume.
|
||||||
|
|
||||||
* `image_id` - (Optional) The image ID from which to create the volume.
|
* `image_id` - (Optional) The image ID from which to create the volume.
|
||||||
Changing this creates a new volume.
|
Changing this creates a new volume.
|
||||||
|
|
||||||
|
@ -61,6 +64,7 @@ The following attributes are exported:
|
||||||
* `size` - See Argument Reference above.
|
* `size` - See Argument Reference above.
|
||||||
* `name` - See Argument Reference above.
|
* `name` - See Argument Reference above.
|
||||||
* `description` - See Argument Reference above.
|
* `description` - See Argument Reference above.
|
||||||
|
* `availability_zone` - See Argument Reference above.
|
||||||
* `image_id` - See Argument Reference above.
|
* `image_id` - See Argument Reference above.
|
||||||
* `source_vol_id` - See Argument Reference above.
|
* `source_vol_id` - See Argument Reference above.
|
||||||
* `snapshot_id` - See Argument Reference above.
|
* `snapshot_id` - See Argument Reference above.
|
||||||
|
|
Loading…
Reference in New Issue