Class VolumeAttach
Attaches a Block Storage Volume to an Instance using the OpenStack Compute (Nova) v2 API.
Example Usage
Basic attachment of a single volume to a single instance
using Pulumi;
using OpenStack = Pulumi.OpenStack;
class MyStack : Stack
{
public MyStack()
{
var volume1 = new OpenStack.BlockStorage.VolumeV2("volume1", new OpenStack.BlockStorage.VolumeV2Args
{
Size = 1,
});
var instance1 = new OpenStack.Compute.Instance("instance1", new OpenStack.Compute.InstanceArgs
{
SecurityGroups =
{
"default",
},
});
var va1 = new OpenStack.Compute.VolumeAttach("va1", new OpenStack.Compute.VolumeAttachArgs
{
InstanceId = instance1.Id,
VolumeId = volume1.Id,
});
}
}
Using Multiattach-enabled volumes
using Pulumi;
using OpenStack = Pulumi.OpenStack;
class MyStack : Stack
{
public MyStack()
{
var volume1 = new OpenStack.BlockStorage.Volume("volume1", new OpenStack.BlockStorage.VolumeArgs
{
Multiattach = true,
Size = 1,
});
var instance1 = new OpenStack.Compute.Instance("instance1", new OpenStack.Compute.InstanceArgs
{
SecurityGroups =
{
"default",
},
});
var instance2 = new OpenStack.Compute.Instance("instance2", new OpenStack.Compute.InstanceArgs
{
SecurityGroups =
{
"default",
},
});
var va1 = new OpenStack.Compute.VolumeAttach("va1", new OpenStack.Compute.VolumeAttachArgs
{
InstanceId = instance1.Id,
Multiattach = true,
VolumeId = openstack_blockstorage_volume_v2.Volume_1.Id,
});
var va2 = new OpenStack.Compute.VolumeAttach("va2", new OpenStack.Compute.VolumeAttachArgs
{
InstanceId = instance2.Id,
Multiattach = true,
VolumeId = openstack_blockstorage_volume_v2.Volume_1.Id,
});
}
}
Inherited Members
Namespace: Pulumi.OpenStack.Compute
Assembly: Pulumi.OpenStack.dll
Syntax
public class VolumeAttach : CustomResource
Constructors
View SourceVolumeAttach(String, VolumeAttachArgs, CustomResourceOptions)
Create a VolumeAttach resource with the given unique name, arguments, and options.
Declaration
public VolumeAttach(string name, VolumeAttachArgs args, CustomResourceOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The unique name of the resource |
| VolumeAttachArgs | args | The arguments used to populate this resource's properties |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Properties
View SourceDevice
See Argument Reference above. NOTE: The correctness of this information is dependent upon the hypervisor in use. In some cases, this should not be used as an authoritative piece of information.
Declaration
public Output<string> Device { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
InstanceId
The ID of the Instance to attach the Volume to.
Declaration
public Output<string> InstanceId { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Multiattach
Enable attachment of multiattach-capable volumes.
Declaration
public Output<bool?> Multiattach { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Nullable<System.Boolean>> |
Region
The region in which to obtain the V2 Compute client.
A Compute client is needed to create a volume attachment. If omitted, the
region argument of the provider is used. Changing this creates a
new volume attachment.
Declaration
public Output<string> Region { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
VolumeId
The ID of the Volume to attach to an Instance.
Declaration
public Output<string> VolumeId { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Methods
View SourceGet(String, Input<String>, VolumeAttachState, CustomResourceOptions)
Get an existing VolumeAttach resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
Declaration
public static VolumeAttach Get(string name, Input<string> id, VolumeAttachState state = null, CustomResourceOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The unique name of the resulting resource. |
| Input<System.String> | id | The unique provider ID of the resource to lookup. |
| VolumeAttachState | state | Any extra arguments used during the lookup. |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Returns
| Type | Description |
|---|---|
| VolumeAttach |