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,
        });
    }

}

Coming soon!

import pulumi
import pulumi_openstack as openstack

volume1 = openstack.blockstorage.VolumeV2("volume1", size=1)
instance1 = openstack.compute.Instance("instance1", security_groups=["default"])
va1 = openstack.compute.VolumeAttach("va1",
    instance_id=instance1.id,
    volume_id=volume1.id)
import * as pulumi from "@pulumi/pulumi";
import * as openstack from "@pulumi/openstack";

const volume1 = new openstack.blockstorage.VolumeV2("volume_1", {
    size: 1,
});
const instance1 = new openstack.compute.Instance("instance_1", {
    securityGroups: ["default"],
});
const va1 = new openstack.compute.VolumeAttach("va_1", {
    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,
        });
    }

}

Coming soon!

import pulumi
import pulumi_openstack as openstack

volume1 = openstack.blockstorage.Volume("volume1",
    multiattach=True,
    size=1)
instance1 = openstack.compute.Instance("instance1", security_groups=["default"])
instance2 = openstack.compute.Instance("instance2", security_groups=["default"])
va1 = openstack.compute.VolumeAttach("va1",
    instance_id=instance1.id,
    multiattach=True,
    volume_id=openstack_blockstorage_volume_v2["volume_1"]["id"])
va2 = openstack.compute.VolumeAttach("va2",
    instance_id=instance2.id,
    multiattach=True,
    volume_id=openstack_blockstorage_volume_v2["volume_1"]["id"])
import * as pulumi from "@pulumi/pulumi";
import * as openstack from "@pulumi/openstack";

const volume1 = new openstack.blockstorage.Volume("volume_1", {
    multiattach: true,
    size: 1,
});
const instance1 = new openstack.compute.Instance("instance_1", {
    securityGroups: ["default"],
});
const instance2 = new openstack.compute.Instance("instance_2", {
    securityGroups: ["default"],
});
const va1 = new openstack.compute.VolumeAttach("va_1", {
    instanceId: instance1.id,
    multiattach: true,
    volumeId: openstack_blockstorage_volume_v2_volume_1.id,
});
const va2 = new openstack.compute.VolumeAttach("va_2", {
    instanceId: instance2.id,
    multiattach: true,
    volumeId: openstack_blockstorage_volume_v2_volume_1.id,
}, { dependsOn: [va1] });

Create a VolumeAttach Resource

def VolumeAttach(resource_name, opts=None, device=None, instance_id=None, multiattach=None, region=None, volume_id=None, __props__=None);
func NewVolumeAttach(ctx *Context, name string, args VolumeAttachArgs, opts ...ResourceOption) (*VolumeAttach, error)
name string
The unique name of the resource.
args VolumeAttachArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
opts ResourceOptions
A bag of options that control this resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args VolumeAttachArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args VolumeAttachArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

VolumeAttach Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.

Inputs

The VolumeAttach resource accepts the following input properties:

InstanceId string

The ID of the Instance to attach the Volume to.

VolumeId string

The ID of the Volume to attach to an Instance.

Device string

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.

Multiattach bool

Enable attachment of multiattach-capable volumes.

Region string

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.

InstanceId string

The ID of the Instance to attach the Volume to.

VolumeId string

The ID of the Volume to attach to an Instance.

Device string

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.

Multiattach bool

Enable attachment of multiattach-capable volumes.

Region string

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.

instanceId string

The ID of the Instance to attach the Volume to.

volumeId string

The ID of the Volume to attach to an Instance.

device string

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.

multiattach boolean

Enable attachment of multiattach-capable volumes.

region string

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.

instance_id str

The ID of the Instance to attach the Volume to.

volume_id str

The ID of the Volume to attach to an Instance.

device str

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.

multiattach bool

Enable attachment of multiattach-capable volumes.

region str

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.

Outputs

All input properties are implicitly available as output properties. Additionally, the VolumeAttach resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.

Look up an Existing VolumeAttach Resource

Get an existing VolumeAttach resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: VolumeAttachState, opts?: CustomResourceOptions): VolumeAttach
static get(resource_name, id, opts=None, device=None, instance_id=None, multiattach=None, region=None, volume_id=None, __props__=None);
func GetVolumeAttach(ctx *Context, name string, id IDInput, state *VolumeAttachState, opts ...ResourceOption) (*VolumeAttach, error)
public static VolumeAttach Get(string name, Input<string> id, VolumeAttachState? state, CustomResourceOptions? opts = null)
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.

The following state arguments are supported:

Device string

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.

InstanceId string

The ID of the Instance to attach the Volume to.

Multiattach bool

Enable attachment of multiattach-capable volumes.

Region string

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.

VolumeId string

The ID of the Volume to attach to an Instance.

Device string

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.

InstanceId string

The ID of the Instance to attach the Volume to.

Multiattach bool

Enable attachment of multiattach-capable volumes.

Region string

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.

VolumeId string

The ID of the Volume to attach to an Instance.

device string

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.

instanceId string

The ID of the Instance to attach the Volume to.

multiattach boolean

Enable attachment of multiattach-capable volumes.

region string

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.

volumeId string

The ID of the Volume to attach to an Instance.

device str

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.

instance_id str

The ID of the Instance to attach the Volume to.

multiattach bool

Enable attachment of multiattach-capable volumes.

region str

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.

volume_id str

The ID of the Volume to attach to an Instance.

Package Details

Repository
https://github.com/pulumi/pulumi-openstack
License
Apache-2.0
Notes
This Pulumi package is based on the openstack Terraform Provider.