1. Packages
  2. Alibaba Cloud
  3. API Docs
  4. ens
  5. DiskInstanceAttachment
Alibaba Cloud v3.55.0 published on Tuesday, Apr 30, 2024 by Pulumi

alicloud.ens.DiskInstanceAttachment

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.55.0 published on Tuesday, Apr 30, 2024 by Pulumi

    Provides a ENS Disk Instance Attachment resource. Disk instance mount.

    For information about ENS Disk Instance Attachment and how to use it, see What is Disk Instance Attachment.

    NOTE: Available since v1.216.0.

    Example Usage

    Basic Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const config = new pulumi.Config();
    const name = config.get("name") || "terraform-example";
    const _default = new alicloud.ens.Disk("default", {
        size: 20,
        ensRegionId: "cn-chenzhou-telecom_unicom_cmcc",
        paymentType: "PayAsYouGo",
        category: "cloud_efficiency",
    });
    const defaultInstance = new alicloud.ens.Instance("default", {
        systemDisk: {
            size: 20,
        },
        imageId: "centos_6_08_64_20G_alibase_20171208",
        paymentType: "Subscription",
        instanceType: "ens.sn1.stiny",
        password: "12345678ABCabc",
        amount: 1,
        internetMaxBandwidthOut: 10,
        uniqueSuffix: true,
        publicIpIdentification: true,
        ensRegionId: "cn-chenzhou-telecom_unicom_cmcc",
        scheduleAreaLevel: "Region",
        periodUnit: "Month",
        period: 1,
    });
    const defaultDiskInstanceAttachment = new alicloud.ens.DiskInstanceAttachment("default", {
        instanceId: defaultInstance.id,
        deleteWithInstance: "false",
        diskId: _default.id,
    });
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    config = pulumi.Config()
    name = config.get("name")
    if name is None:
        name = "terraform-example"
    default = alicloud.ens.Disk("default",
        size=20,
        ens_region_id="cn-chenzhou-telecom_unicom_cmcc",
        payment_type="PayAsYouGo",
        category="cloud_efficiency")
    default_instance = alicloud.ens.Instance("default",
        system_disk=alicloud.ens.InstanceSystemDiskArgs(
            size=20,
        ),
        image_id="centos_6_08_64_20G_alibase_20171208",
        payment_type="Subscription",
        instance_type="ens.sn1.stiny",
        password="12345678ABCabc",
        amount=1,
        internet_max_bandwidth_out=10,
        unique_suffix=True,
        public_ip_identification=True,
        ens_region_id="cn-chenzhou-telecom_unicom_cmcc",
        schedule_area_level="Region",
        period_unit="Month",
        period=1)
    default_disk_instance_attachment = alicloud.ens.DiskInstanceAttachment("default",
        instance_id=default_instance.id,
        delete_with_instance="false",
        disk_id=default.id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ens"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		cfg := config.New(ctx, "")
    		name := "terraform-example"
    		if param := cfg.Get("name"); param != "" {
    			name = param
    		}
    		_, err := ens.NewDisk(ctx, "default", &ens.DiskArgs{
    			Size:        pulumi.Int(20),
    			EnsRegionId: pulumi.String("cn-chenzhou-telecom_unicom_cmcc"),
    			PaymentType: pulumi.String("PayAsYouGo"),
    			Category:    pulumi.String("cloud_efficiency"),
    		})
    		if err != nil {
    			return err
    		}
    		defaultInstance, err := ens.NewInstance(ctx, "default", &ens.InstanceArgs{
    			SystemDisk: &ens.InstanceSystemDiskArgs{
    				Size: pulumi.Int(20),
    			},
    			ImageId:                 pulumi.String("centos_6_08_64_20G_alibase_20171208"),
    			PaymentType:             pulumi.String("Subscription"),
    			InstanceType:            pulumi.String("ens.sn1.stiny"),
    			Password:                pulumi.String("12345678ABCabc"),
    			Amount:                  pulumi.Int(1),
    			InternetMaxBandwidthOut: pulumi.Int(10),
    			UniqueSuffix:            pulumi.Bool(true),
    			PublicIpIdentification:  pulumi.Bool(true),
    			EnsRegionId:             pulumi.String("cn-chenzhou-telecom_unicom_cmcc"),
    			ScheduleAreaLevel:       pulumi.String("Region"),
    			PeriodUnit:              pulumi.String("Month"),
    			Period:                  pulumi.Int(1),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = ens.NewDiskInstanceAttachment(ctx, "default", &ens.DiskInstanceAttachmentArgs{
    			InstanceId:         defaultInstance.ID(),
    			DeleteWithInstance: pulumi.String("false"),
    			DiskId:             _default.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var config = new Config();
        var name = config.Get("name") ?? "terraform-example";
        var @default = new AliCloud.Ens.Disk("default", new()
        {
            Size = 20,
            EnsRegionId = "cn-chenzhou-telecom_unicom_cmcc",
            PaymentType = "PayAsYouGo",
            Category = "cloud_efficiency",
        });
    
        var defaultInstance = new AliCloud.Ens.Instance("default", new()
        {
            SystemDisk = new AliCloud.Ens.Inputs.InstanceSystemDiskArgs
            {
                Size = 20,
            },
            ImageId = "centos_6_08_64_20G_alibase_20171208",
            PaymentType = "Subscription",
            InstanceType = "ens.sn1.stiny",
            Password = "12345678ABCabc",
            Amount = 1,
            InternetMaxBandwidthOut = 10,
            UniqueSuffix = true,
            PublicIpIdentification = true,
            EnsRegionId = "cn-chenzhou-telecom_unicom_cmcc",
            ScheduleAreaLevel = "Region",
            PeriodUnit = "Month",
            Period = 1,
        });
    
        var defaultDiskInstanceAttachment = new AliCloud.Ens.DiskInstanceAttachment("default", new()
        {
            InstanceId = defaultInstance.Id,
            DeleteWithInstance = "false",
            DiskId = @default.Id,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.ens.Disk;
    import com.pulumi.alicloud.ens.DiskArgs;
    import com.pulumi.alicloud.ens.Instance;
    import com.pulumi.alicloud.ens.InstanceArgs;
    import com.pulumi.alicloud.ens.inputs.InstanceSystemDiskArgs;
    import com.pulumi.alicloud.ens.DiskInstanceAttachment;
    import com.pulumi.alicloud.ens.DiskInstanceAttachmentArgs;
    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) {
            final var config = ctx.config();
            final var name = config.get("name").orElse("terraform-example");
            var default_ = new Disk("default", DiskArgs.builder()        
                .size("20")
                .ensRegionId("cn-chenzhou-telecom_unicom_cmcc")
                .paymentType("PayAsYouGo")
                .category("cloud_efficiency")
                .build());
    
            var defaultInstance = new Instance("defaultInstance", InstanceArgs.builder()        
                .systemDisk(InstanceSystemDiskArgs.builder()
                    .size("20")
                    .build())
                .imageId("centos_6_08_64_20G_alibase_20171208")
                .paymentType("Subscription")
                .instanceType("ens.sn1.stiny")
                .password("12345678ABCabc")
                .amount("1")
                .internetMaxBandwidthOut("10")
                .uniqueSuffix(true)
                .publicIpIdentification(true)
                .ensRegionId("cn-chenzhou-telecom_unicom_cmcc")
                .scheduleAreaLevel("Region")
                .periodUnit("Month")
                .period("1")
                .build());
    
            var defaultDiskInstanceAttachment = new DiskInstanceAttachment("defaultDiskInstanceAttachment", DiskInstanceAttachmentArgs.builder()        
                .instanceId(defaultInstance.id())
                .deleteWithInstance("false")
                .diskId(default_.id())
                .build());
    
        }
    }
    
    configuration:
      name:
        type: string
        default: terraform-example
    resources:
      default:
        type: alicloud:ens:Disk
        properties:
          size: '20'
          ensRegionId: cn-chenzhou-telecom_unicom_cmcc
          paymentType: PayAsYouGo
          category: cloud_efficiency
      defaultInstance:
        type: alicloud:ens:Instance
        name: default
        properties:
          systemDisk:
            size: '20'
          imageId: centos_6_08_64_20G_alibase_20171208
          paymentType: Subscription
          instanceType: ens.sn1.stiny
          password: 12345678ABCabc
          amount: '1'
          internetMaxBandwidthOut: '10'
          uniqueSuffix: true
          publicIpIdentification: true
          ensRegionId: cn-chenzhou-telecom_unicom_cmcc
          scheduleAreaLevel: Region
          periodUnit: Month
          period: '1'
      defaultDiskInstanceAttachment:
        type: alicloud:ens:DiskInstanceAttachment
        name: default
        properties:
          instanceId: ${defaultInstance.id}
          deleteWithInstance: 'false'
          diskId: ${default.id}
    

    Create DiskInstanceAttachment Resource

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

    Constructor syntax

    new DiskInstanceAttachment(name: string, args: DiskInstanceAttachmentArgs, opts?: CustomResourceOptions);
    @overload
    def DiskInstanceAttachment(resource_name: str,
                               args: DiskInstanceAttachmentArgs,
                               opts: Optional[ResourceOptions] = None)
    
    @overload
    def DiskInstanceAttachment(resource_name: str,
                               opts: Optional[ResourceOptions] = None,
                               disk_id: Optional[str] = None,
                               instance_id: Optional[str] = None,
                               delete_with_instance: Optional[str] = None)
    func NewDiskInstanceAttachment(ctx *Context, name string, args DiskInstanceAttachmentArgs, opts ...ResourceOption) (*DiskInstanceAttachment, error)
    public DiskInstanceAttachment(string name, DiskInstanceAttachmentArgs args, CustomResourceOptions? opts = null)
    public DiskInstanceAttachment(String name, DiskInstanceAttachmentArgs args)
    public DiskInstanceAttachment(String name, DiskInstanceAttachmentArgs args, CustomResourceOptions options)
    
    type: alicloud:ens:DiskInstanceAttachment
    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 DiskInstanceAttachmentArgs
    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 DiskInstanceAttachmentArgs
    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 DiskInstanceAttachmentArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args DiskInstanceAttachmentArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args DiskInstanceAttachmentArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Example

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

    var diskInstanceAttachmentResource = new AliCloud.Ens.DiskInstanceAttachment("diskInstanceAttachmentResource", new()
    {
        DiskId = "string",
        InstanceId = "string",
        DeleteWithInstance = "string",
    });
    
    example, err := ens.NewDiskInstanceAttachment(ctx, "diskInstanceAttachmentResource", &ens.DiskInstanceAttachmentArgs{
    	DiskId:             pulumi.String("string"),
    	InstanceId:         pulumi.String("string"),
    	DeleteWithInstance: pulumi.String("string"),
    })
    
    var diskInstanceAttachmentResource = new DiskInstanceAttachment("diskInstanceAttachmentResource", DiskInstanceAttachmentArgs.builder()        
        .diskId("string")
        .instanceId("string")
        .deleteWithInstance("string")
        .build());
    
    disk_instance_attachment_resource = alicloud.ens.DiskInstanceAttachment("diskInstanceAttachmentResource",
        disk_id="string",
        instance_id="string",
        delete_with_instance="string")
    
    const diskInstanceAttachmentResource = new alicloud.ens.DiskInstanceAttachment("diskInstanceAttachmentResource", {
        diskId: "string",
        instanceId: "string",
        deleteWithInstance: "string",
    });
    
    type: alicloud:ens:DiskInstanceAttachment
    properties:
        deleteWithInstance: string
        diskId: string
        instanceId: string
    

    DiskInstanceAttachment Resource Properties

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

    Inputs

    The DiskInstanceAttachment resource accepts the following input properties:

    DiskId string
    The ID of the cloud disk to be mounted. The Cloud Disk (DiskId) and the instance (InstanceId) must be on the same node.
    InstanceId string
    Instance ID.
    DeleteWithInstance string
    Whether the cloud disk to be mounted is released with the instance Value: true: When the instance is released, the cloud disk is released together with the instance. false: When the instance is released, the cloud disk is retained and is not released together with the instance. Empty means false by default.
    DiskId string
    The ID of the cloud disk to be mounted. The Cloud Disk (DiskId) and the instance (InstanceId) must be on the same node.
    InstanceId string
    Instance ID.
    DeleteWithInstance string
    Whether the cloud disk to be mounted is released with the instance Value: true: When the instance is released, the cloud disk is released together with the instance. false: When the instance is released, the cloud disk is retained and is not released together with the instance. Empty means false by default.
    diskId String
    The ID of the cloud disk to be mounted. The Cloud Disk (DiskId) and the instance (InstanceId) must be on the same node.
    instanceId String
    Instance ID.
    deleteWithInstance String
    Whether the cloud disk to be mounted is released with the instance Value: true: When the instance is released, the cloud disk is released together with the instance. false: When the instance is released, the cloud disk is retained and is not released together with the instance. Empty means false by default.
    diskId string
    The ID of the cloud disk to be mounted. The Cloud Disk (DiskId) and the instance (InstanceId) must be on the same node.
    instanceId string
    Instance ID.
    deleteWithInstance string
    Whether the cloud disk to be mounted is released with the instance Value: true: When the instance is released, the cloud disk is released together with the instance. false: When the instance is released, the cloud disk is retained and is not released together with the instance. Empty means false by default.
    disk_id str
    The ID of the cloud disk to be mounted. The Cloud Disk (DiskId) and the instance (InstanceId) must be on the same node.
    instance_id str
    Instance ID.
    delete_with_instance str
    Whether the cloud disk to be mounted is released with the instance Value: true: When the instance is released, the cloud disk is released together with the instance. false: When the instance is released, the cloud disk is retained and is not released together with the instance. Empty means false by default.
    diskId String
    The ID of the cloud disk to be mounted. The Cloud Disk (DiskId) and the instance (InstanceId) must be on the same node.
    instanceId String
    Instance ID.
    deleteWithInstance String
    Whether the cloud disk to be mounted is released with the instance Value: true: When the instance is released, the cloud disk is released together with the instance. false: When the instance is released, the cloud disk is retained and is not released together with the instance. Empty means false by default.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the DiskInstanceAttachment 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 DiskInstanceAttachment Resource

    Get an existing DiskInstanceAttachment 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?: DiskInstanceAttachmentState, opts?: CustomResourceOptions): DiskInstanceAttachment
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            delete_with_instance: Optional[str] = None,
            disk_id: Optional[str] = None,
            instance_id: Optional[str] = None) -> DiskInstanceAttachment
    func GetDiskInstanceAttachment(ctx *Context, name string, id IDInput, state *DiskInstanceAttachmentState, opts ...ResourceOption) (*DiskInstanceAttachment, error)
    public static DiskInstanceAttachment Get(string name, Input<string> id, DiskInstanceAttachmentState? state, CustomResourceOptions? opts = null)
    public static DiskInstanceAttachment get(String name, Output<String> id, DiskInstanceAttachmentState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    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:
    DeleteWithInstance string
    Whether the cloud disk to be mounted is released with the instance Value: true: When the instance is released, the cloud disk is released together with the instance. false: When the instance is released, the cloud disk is retained and is not released together with the instance. Empty means false by default.
    DiskId string
    The ID of the cloud disk to be mounted. The Cloud Disk (DiskId) and the instance (InstanceId) must be on the same node.
    InstanceId string
    Instance ID.
    DeleteWithInstance string
    Whether the cloud disk to be mounted is released with the instance Value: true: When the instance is released, the cloud disk is released together with the instance. false: When the instance is released, the cloud disk is retained and is not released together with the instance. Empty means false by default.
    DiskId string
    The ID of the cloud disk to be mounted. The Cloud Disk (DiskId) and the instance (InstanceId) must be on the same node.
    InstanceId string
    Instance ID.
    deleteWithInstance String
    Whether the cloud disk to be mounted is released with the instance Value: true: When the instance is released, the cloud disk is released together with the instance. false: When the instance is released, the cloud disk is retained and is not released together with the instance. Empty means false by default.
    diskId String
    The ID of the cloud disk to be mounted. The Cloud Disk (DiskId) and the instance (InstanceId) must be on the same node.
    instanceId String
    Instance ID.
    deleteWithInstance string
    Whether the cloud disk to be mounted is released with the instance Value: true: When the instance is released, the cloud disk is released together with the instance. false: When the instance is released, the cloud disk is retained and is not released together with the instance. Empty means false by default.
    diskId string
    The ID of the cloud disk to be mounted. The Cloud Disk (DiskId) and the instance (InstanceId) must be on the same node.
    instanceId string
    Instance ID.
    delete_with_instance str
    Whether the cloud disk to be mounted is released with the instance Value: true: When the instance is released, the cloud disk is released together with the instance. false: When the instance is released, the cloud disk is retained and is not released together with the instance. Empty means false by default.
    disk_id str
    The ID of the cloud disk to be mounted. The Cloud Disk (DiskId) and the instance (InstanceId) must be on the same node.
    instance_id str
    Instance ID.
    deleteWithInstance String
    Whether the cloud disk to be mounted is released with the instance Value: true: When the instance is released, the cloud disk is released together with the instance. false: When the instance is released, the cloud disk is retained and is not released together with the instance. Empty means false by default.
    diskId String
    The ID of the cloud disk to be mounted. The Cloud Disk (DiskId) and the instance (InstanceId) must be on the same node.
    instanceId String
    Instance ID.

    Import

    ENS Disk Instance Attachment can be imported using the id, e.g.

    $ pulumi import alicloud:ens/diskInstanceAttachment:DiskInstanceAttachment example <disk_id>:<instance_id>
    

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

    Package Details

    Repository
    Alibaba Cloud pulumi/pulumi-alicloud
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the alicloud Terraform Provider.
    alicloud logo
    Alibaba Cloud v3.55.0 published on Tuesday, Apr 30, 2024 by Pulumi