1. Packages
  2. Flexibleengine Provider
  3. API Docs
  4. ComputeVolumeAttachV2
flexibleengine 1.46.0 published on Monday, Apr 14, 2025 by flexibleenginecloud

flexibleengine.ComputeVolumeAttachV2

Explore with Pulumi AI

flexibleengine logo
flexibleengine 1.46.0 published on Monday, Apr 14, 2025 by flexibleenginecloud

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

    Example Usage

    Basic attachment of a single volume to a single instance

    import * as pulumi from "@pulumi/pulumi";
    import * as flexibleengine from "@pulumi/flexibleengine";
    
    const volume1 = new flexibleengine.BlockstorageVolumeV2("volume1", {size: 1});
    const instance1 = new flexibleengine.ComputeInstanceV2("instance1", {securityGroups: ["default"]});
    const va1 = new flexibleengine.ComputeVolumeAttachV2("va1", {
        instanceId: instance1.computeInstanceV2Id,
        volumeId: volume1.blockstorageVolumeV2Id,
    });
    
    import pulumi
    import pulumi_flexibleengine as flexibleengine
    
    volume1 = flexibleengine.BlockstorageVolumeV2("volume1", size=1)
    instance1 = flexibleengine.ComputeInstanceV2("instance1", security_groups=["default"])
    va1 = flexibleengine.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/flexibleengine/flexibleengine"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		volume1, err := flexibleengine.NewBlockstorageVolumeV2(ctx, "volume1", &flexibleengine.BlockstorageVolumeV2Args{
    			Size: pulumi.Float64(1),
    		})
    		if err != nil {
    			return err
    		}
    		instance1, err := flexibleengine.NewComputeInstanceV2(ctx, "instance1", &flexibleengine.ComputeInstanceV2Args{
    			SecurityGroups: pulumi.StringArray{
    				pulumi.String("default"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = flexibleengine.NewComputeVolumeAttachV2(ctx, "va1", &flexibleengine.ComputeVolumeAttachV2Args{
    			InstanceId: instance1.ComputeInstanceV2Id,
    			VolumeId:   volume1.BlockstorageVolumeV2Id,
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Flexibleengine = Pulumi.Flexibleengine;
    
    return await Deployment.RunAsync(() => 
    {
        var volume1 = new Flexibleengine.BlockstorageVolumeV2("volume1", new()
        {
            Size = 1,
        });
    
        var instance1 = new Flexibleengine.ComputeInstanceV2("instance1", new()
        {
            SecurityGroups = new[]
            {
                "default",
            },
        });
    
        var va1 = new Flexibleengine.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.flexibleengine.BlockstorageVolumeV2;
    import com.pulumi.flexibleengine.BlockstorageVolumeV2Args;
    import com.pulumi.flexibleengine.ComputeInstanceV2;
    import com.pulumi.flexibleengine.ComputeInstanceV2Args;
    import com.pulumi.flexibleengine.ComputeVolumeAttachV2;
    import com.pulumi.flexibleengine.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: flexibleengine:BlockstorageVolumeV2
        properties:
          size: 1
      instance1:
        type: flexibleengine:ComputeInstanceV2
        properties:
          securityGroups:
            - default
      va1:
        type: flexibleengine: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: flexibleengine: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 Flexibleengine.ComputeVolumeAttachV2("computeVolumeAttachV2Resource", new()
    {
        InstanceId = "string",
        VolumeId = "string",
        ComputeVolumeAttachV2Id = "string",
        Device = "string",
        Region = "string",
        Timeouts = new Flexibleengine.Inputs.ComputeVolumeAttachV2TimeoutsArgs
        {
            Create = "string",
            Delete = "string",
        },
    });
    
    example, err := flexibleengine.NewComputeVolumeAttachV2(ctx, "computeVolumeAttachV2Resource", &flexibleengine.ComputeVolumeAttachV2Args{
    	InstanceId:              pulumi.String("string"),
    	VolumeId:                pulumi.String("string"),
    	ComputeVolumeAttachV2Id: pulumi.String("string"),
    	Device:                  pulumi.String("string"),
    	Region:                  pulumi.String("string"),
    	Timeouts: &flexibleengine.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 = flexibleengine.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 flexibleengine.ComputeVolumeAttachV2("computeVolumeAttachV2Resource", {
        instanceId: "string",
        volumeId: "string",
        computeVolumeAttachV2Id: "string",
        device: "string",
        region: "string",
        timeouts: {
            create: "string",
            "delete": "string",
        },
    });
    
    type: flexibleengine: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
    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.
    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
    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.
    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
    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.
    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
    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.
    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
    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.
    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
    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.
    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: flexibleengine: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
    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.
    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
    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.
    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
    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.
    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
    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.
    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
    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.
    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
    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.
    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 flexibleengine: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
    flexibleengine flexibleenginecloud/terraform-provider-flexibleengine
    License
    Notes
    This Pulumi package is based on the flexibleengine Terraform Provider.
    flexibleengine logo
    flexibleengine 1.46.0 published on Monday, Apr 14, 2025 by flexibleenginecloud