1. Packages
  2. Opentelekomcloud Provider
  3. API Docs
  4. ComputeVolumeAttachV2
opentelekomcloud 1.36.37 published on Thursday, Apr 24, 2025 by opentelekomcloud

opentelekomcloud.ComputeVolumeAttachV2

Explore with Pulumi AI

opentelekomcloud logo
opentelekomcloud 1.36.37 published on Thursday, Apr 24, 2025 by opentelekomcloud

    Up-to-date reference of API arguments for ECS disk management you can get at documentation portal

    Attaches a Block Storage Volume to an Instance using the OpenTelekomCloud Compute (Nova) v2 API.

    Example Usage

    Basic attachment of a single volume to a single instance

    import * as pulumi from "@pulumi/pulumi";
    import * as opentelekomcloud from "@pulumi/opentelekomcloud";
    
    const volume1 = new opentelekomcloud.BlockstorageVolumeV2("volume1", {size: 1});
    const instance1 = new opentelekomcloud.ComputeInstanceV2("instance1", {securityGroups: ["default"]});
    const va1 = new opentelekomcloud.ComputeVolumeAttachV2("va1", {
        instanceId: instance1.computeInstanceV2Id,
        volumeId: volume1.blockstorageVolumeV2Id,
    });
    
    import pulumi
    import pulumi_opentelekomcloud as opentelekomcloud
    
    volume1 = opentelekomcloud.BlockstorageVolumeV2("volume1", size=1)
    instance1 = opentelekomcloud.ComputeInstanceV2("instance1", security_groups=["default"])
    va1 = opentelekomcloud.ComputeVolumeAttachV2("va1",
        instance_id=instance1.compute_instance_v2_id,
        volume_id=volume1.blockstorage_volume_v2_id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/opentelekomcloud/opentelekomcloud"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		volume1, err := opentelekomcloud.NewBlockstorageVolumeV2(ctx, "volume1", &opentelekomcloud.BlockstorageVolumeV2Args{
    			Size: pulumi.Float64(1),
    		})
    		if err != nil {
    			return err
    		}
    		instance1, err := opentelekomcloud.NewComputeInstanceV2(ctx, "instance1", &opentelekomcloud.ComputeInstanceV2Args{
    			SecurityGroups: pulumi.StringArray{
    				pulumi.String("default"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = opentelekomcloud.NewComputeVolumeAttachV2(ctx, "va1", &opentelekomcloud.ComputeVolumeAttachV2Args{
    			InstanceId: instance1.ComputeInstanceV2Id,
    			VolumeId:   volume1.BlockstorageVolumeV2Id,
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Opentelekomcloud = Pulumi.Opentelekomcloud;
    
    return await Deployment.RunAsync(() => 
    {
        var volume1 = new Opentelekomcloud.BlockstorageVolumeV2("volume1", new()
        {
            Size = 1,
        });
    
        var instance1 = new Opentelekomcloud.ComputeInstanceV2("instance1", new()
        {
            SecurityGroups = new[]
            {
                "default",
            },
        });
    
        var va1 = new Opentelekomcloud.ComputeVolumeAttachV2("va1", new()
        {
            InstanceId = instance1.ComputeInstanceV2Id,
            VolumeId = volume1.BlockstorageVolumeV2Id,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.opentelekomcloud.BlockstorageVolumeV2;
    import com.pulumi.opentelekomcloud.BlockstorageVolumeV2Args;
    import com.pulumi.opentelekomcloud.ComputeInstanceV2;
    import com.pulumi.opentelekomcloud.ComputeInstanceV2Args;
    import com.pulumi.opentelekomcloud.ComputeVolumeAttachV2;
    import com.pulumi.opentelekomcloud.ComputeVolumeAttachV2Args;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            var volume1 = new BlockstorageVolumeV2("volume1", BlockstorageVolumeV2Args.builder()
                .size(1)
                .build());
    
            var instance1 = new ComputeInstanceV2("instance1", ComputeInstanceV2Args.builder()
                .securityGroups("default")
                .build());
    
            var va1 = new ComputeVolumeAttachV2("va1", ComputeVolumeAttachV2Args.builder()
                .instanceId(instance1.computeInstanceV2Id())
                .volumeId(volume1.blockstorageVolumeV2Id())
                .build());
    
        }
    }
    
    resources:
      volume1:
        type: opentelekomcloud:BlockstorageVolumeV2
        properties:
          size: 1
      instance1:
        type: opentelekomcloud:ComputeInstanceV2
        properties:
          securityGroups:
            - default
      va1:
        type: opentelekomcloud:ComputeVolumeAttachV2
        properties:
          instanceId: ${instance1.computeInstanceV2Id}
          volumeId: ${volume1.blockstorageVolumeV2Id}
    

    Create ComputeVolumeAttachV2 Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new ComputeVolumeAttachV2(name: string, args: ComputeVolumeAttachV2Args, opts?: CustomResourceOptions);
    @overload
    def ComputeVolumeAttachV2(resource_name: str,
                              args: ComputeVolumeAttachV2Args,
                              opts: Optional[ResourceOptions] = None)
    
    @overload
    def ComputeVolumeAttachV2(resource_name: str,
                              opts: Optional[ResourceOptions] = None,
                              instance_id: Optional[str] = None,
                              volume_id: Optional[str] = None,
                              compute_volume_attach_v2_id: Optional[str] = None,
                              device: Optional[str] = None,
                              region: Optional[str] = None,
                              timeouts: Optional[ComputeVolumeAttachV2TimeoutsArgs] = None)
    func NewComputeVolumeAttachV2(ctx *Context, name string, args ComputeVolumeAttachV2Args, opts ...ResourceOption) (*ComputeVolumeAttachV2, error)
    public ComputeVolumeAttachV2(string name, ComputeVolumeAttachV2Args args, CustomResourceOptions? opts = null)
    public ComputeVolumeAttachV2(String name, ComputeVolumeAttachV2Args args)
    public ComputeVolumeAttachV2(String name, ComputeVolumeAttachV2Args args, CustomResourceOptions options)
    
    type: opentelekomcloud:ComputeVolumeAttachV2
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args ComputeVolumeAttachV2Args
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args ComputeVolumeAttachV2Args
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args ComputeVolumeAttachV2Args
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ComputeVolumeAttachV2Args
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ComputeVolumeAttachV2Args
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var computeVolumeAttachV2Resource = new Opentelekomcloud.ComputeVolumeAttachV2("computeVolumeAttachV2Resource", new()
    {
        InstanceId = "string",
        VolumeId = "string",
        ComputeVolumeAttachV2Id = "string",
        Device = "string",
        Region = "string",
        Timeouts = new Opentelekomcloud.Inputs.ComputeVolumeAttachV2TimeoutsArgs
        {
            Create = "string",
            Delete = "string",
        },
    });
    
    example, err := opentelekomcloud.NewComputeVolumeAttachV2(ctx, "computeVolumeAttachV2Resource", &opentelekomcloud.ComputeVolumeAttachV2Args{
    	InstanceId:              pulumi.String("string"),
    	VolumeId:                pulumi.String("string"),
    	ComputeVolumeAttachV2Id: pulumi.String("string"),
    	Device:                  pulumi.String("string"),
    	Region:                  pulumi.String("string"),
    	Timeouts: &opentelekomcloud.ComputeVolumeAttachV2TimeoutsArgs{
    		Create: pulumi.String("string"),
    		Delete: pulumi.String("string"),
    	},
    })
    
    var computeVolumeAttachV2Resource = new ComputeVolumeAttachV2("computeVolumeAttachV2Resource", ComputeVolumeAttachV2Args.builder()
        .instanceId("string")
        .volumeId("string")
        .computeVolumeAttachV2Id("string")
        .device("string")
        .region("string")
        .timeouts(ComputeVolumeAttachV2TimeoutsArgs.builder()
            .create("string")
            .delete("string")
            .build())
        .build());
    
    compute_volume_attach_v2_resource = opentelekomcloud.ComputeVolumeAttachV2("computeVolumeAttachV2Resource",
        instance_id="string",
        volume_id="string",
        compute_volume_attach_v2_id="string",
        device="string",
        region="string",
        timeouts={
            "create": "string",
            "delete": "string",
        })
    
    const computeVolumeAttachV2Resource = new opentelekomcloud.ComputeVolumeAttachV2("computeVolumeAttachV2Resource", {
        instanceId: "string",
        volumeId: "string",
        computeVolumeAttachV2Id: "string",
        device: "string",
        region: "string",
        timeouts: {
            create: "string",
            "delete": "string",
        },
    });
    
    type: opentelekomcloud:ComputeVolumeAttachV2
    properties:
        computeVolumeAttachV2Id: string
        device: string
        instanceId: string
        region: string
        timeouts:
            create: string
            delete: string
        volumeId: string
    

    ComputeVolumeAttachV2 Resource Properties

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

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The ComputeVolumeAttachV2 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.
    ComputeVolumeAttachV2Id string
    Device string
    Region string
    Timeouts ComputeVolumeAttachV2Timeouts
    InstanceId string
    The ID of the Instance to attach the Volume to.
    VolumeId string
    The ID of the Volume to attach to an Instance.
    ComputeVolumeAttachV2Id string
    Device string
    Region string
    Timeouts ComputeVolumeAttachV2TimeoutsArgs
    instanceId String
    The ID of the Instance to attach the Volume to.
    volumeId String
    The ID of the Volume to attach to an Instance.
    computeVolumeAttachV2Id String
    device String
    region String
    timeouts ComputeVolumeAttachV2Timeouts
    instanceId string
    The ID of the Instance to attach the Volume to.
    volumeId string
    The ID of the Volume to attach to an Instance.
    computeVolumeAttachV2Id string
    device string
    region string
    timeouts ComputeVolumeAttachV2Timeouts
    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.
    compute_volume_attach_v2_id str
    device str
    region str
    timeouts ComputeVolumeAttachV2TimeoutsArgs
    instanceId String
    The ID of the Instance to attach the Volume to.
    volumeId String
    The ID of the Volume to attach to an Instance.
    computeVolumeAttachV2Id String
    device String
    region String
    timeouts Property Map

    Outputs

    All input properties are implicitly available as output properties. Additionally, the ComputeVolumeAttachV2 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 string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing ComputeVolumeAttachV2 Resource

    Get an existing ComputeVolumeAttachV2 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?: ComputeVolumeAttachV2State, opts?: CustomResourceOptions): ComputeVolumeAttachV2
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            compute_volume_attach_v2_id: Optional[str] = None,
            device: Optional[str] = None,
            instance_id: Optional[str] = None,
            region: Optional[str] = None,
            timeouts: Optional[ComputeVolumeAttachV2TimeoutsArgs] = None,
            volume_id: Optional[str] = None) -> ComputeVolumeAttachV2
    func GetComputeVolumeAttachV2(ctx *Context, name string, id IDInput, state *ComputeVolumeAttachV2State, opts ...ResourceOption) (*ComputeVolumeAttachV2, error)
    public static ComputeVolumeAttachV2 Get(string name, Input<string> id, ComputeVolumeAttachV2State? state, CustomResourceOptions? opts = null)
    public static ComputeVolumeAttachV2 get(String name, Output<String> id, ComputeVolumeAttachV2State state, CustomResourceOptions options)
    resources:  _:    type: opentelekomcloud:ComputeVolumeAttachV2    get:      id: ${id}
    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.
    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:
    ComputeVolumeAttachV2Id string
    Device string
    InstanceId string
    The ID of the Instance to attach the Volume to.
    Region string
    Timeouts ComputeVolumeAttachV2Timeouts
    VolumeId string
    The ID of the Volume to attach to an Instance.
    ComputeVolumeAttachV2Id string
    Device string
    InstanceId string
    The ID of the Instance to attach the Volume to.
    Region string
    Timeouts ComputeVolumeAttachV2TimeoutsArgs
    VolumeId string
    The ID of the Volume to attach to an Instance.
    computeVolumeAttachV2Id String
    device String
    instanceId String
    The ID of the Instance to attach the Volume to.
    region String
    timeouts ComputeVolumeAttachV2Timeouts
    volumeId String
    The ID of the Volume to attach to an Instance.
    computeVolumeAttachV2Id string
    device string
    instanceId string
    The ID of the Instance to attach the Volume to.
    region string
    timeouts ComputeVolumeAttachV2Timeouts
    volumeId string
    The ID of the Volume to attach to an Instance.
    compute_volume_attach_v2_id str
    device str
    instance_id str
    The ID of the Instance to attach the Volume to.
    region str
    timeouts ComputeVolumeAttachV2TimeoutsArgs
    volume_id str
    The ID of the Volume to attach to an Instance.
    computeVolumeAttachV2Id String
    device String
    instanceId String
    The ID of the Instance to attach the Volume to.
    region String
    timeouts Property Map
    volumeId String
    The ID of the Volume to attach to an Instance.

    Supporting Types

    ComputeVolumeAttachV2Timeouts, ComputeVolumeAttachV2TimeoutsArgs

    Create string
    Delete string
    Create string
    Delete string
    create String
    delete String
    create string
    delete string
    create str
    delete str
    create String
    delete String

    Import

    Volume Attachments can be imported using the Instance ID and Volume ID separated by a slash, e.g.

    $ pulumi import opentelekomcloud:index/computeVolumeAttachV2:ComputeVolumeAttachV2 va_1 89c60255-9bd6-460c-822a-e2b959ede9d2/45670584-225f-46c3-b33e-6707b589b666
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    opentelekomcloud opentelekomcloud/terraform-provider-opentelekomcloud
    License
    Notes
    This Pulumi package is based on the opentelekomcloud Terraform Provider.
    opentelekomcloud logo
    opentelekomcloud 1.36.37 published on Thursday, Apr 24, 2025 by opentelekomcloud