1. Packages
  2. Alicloud Provider
  3. API Docs
  4. cen
  5. InstanceAttachment
Alibaba Cloud v3.62.1 published on Monday, Sep 16, 2024 by Pulumi

alicloud.cen.InstanceAttachment

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.62.1 published on Monday, Sep 16, 2024 by Pulumi

    Provides a CEN child instance attachment resource that associate the network(VPC, CCN, VBR) with the CEN instance.

    NOTE: Available since v1.42.0.

    Example Usage

    Basic Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const default = alicloud.getRegions({
        current: true,
    });
    const example = new alicloud.vpc.Network("example", {
        vpcName: "tf_example",
        cidrBlock: "172.17.3.0/24",
    });
    const exampleInstance = new alicloud.cen.Instance("example", {
        cenInstanceName: "tf_example",
        description: "an example for cen",
    });
    const exampleInstanceAttachment = new alicloud.cen.InstanceAttachment("example", {
        instanceId: exampleInstance.id,
        childInstanceId: example.id,
        childInstanceType: "VPC",
        childInstanceRegionId: _default.then(_default => _default.regions?.[0]?.id),
    });
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    default = alicloud.get_regions(current=True)
    example = alicloud.vpc.Network("example",
        vpc_name="tf_example",
        cidr_block="172.17.3.0/24")
    example_instance = alicloud.cen.Instance("example",
        cen_instance_name="tf_example",
        description="an example for cen")
    example_instance_attachment = alicloud.cen.InstanceAttachment("example",
        instance_id=example_instance.id,
        child_instance_id=example.id,
        child_instance_type="VPC",
        child_instance_region_id=default.regions[0].id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud"
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/cen"
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/vpc"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_default, err := alicloud.GetRegions(ctx, &alicloud.GetRegionsArgs{
    			Current: pulumi.BoolRef(true),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		example, err := vpc.NewNetwork(ctx, "example", &vpc.NetworkArgs{
    			VpcName:   pulumi.String("tf_example"),
    			CidrBlock: pulumi.String("172.17.3.0/24"),
    		})
    		if err != nil {
    			return err
    		}
    		exampleInstance, err := cen.NewInstance(ctx, "example", &cen.InstanceArgs{
    			CenInstanceName: pulumi.String("tf_example"),
    			Description:     pulumi.String("an example for cen"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = cen.NewInstanceAttachment(ctx, "example", &cen.InstanceAttachmentArgs{
    			InstanceId:            exampleInstance.ID(),
    			ChildInstanceId:       example.ID(),
    			ChildInstanceType:     pulumi.String("VPC"),
    			ChildInstanceRegionId: pulumi.String(_default.Regions[0].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 @default = AliCloud.GetRegions.Invoke(new()
        {
            Current = true,
        });
    
        var example = new AliCloud.Vpc.Network("example", new()
        {
            VpcName = "tf_example",
            CidrBlock = "172.17.3.0/24",
        });
    
        var exampleInstance = new AliCloud.Cen.Instance("example", new()
        {
            CenInstanceName = "tf_example",
            Description = "an example for cen",
        });
    
        var exampleInstanceAttachment = new AliCloud.Cen.InstanceAttachment("example", new()
        {
            InstanceId = exampleInstance.Id,
            ChildInstanceId = example.Id,
            ChildInstanceType = "VPC",
            ChildInstanceRegionId = @default.Apply(@default => @default.Apply(getRegionsResult => getRegionsResult.Regions[0]?.Id)),
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.AlicloudFunctions;
    import com.pulumi.alicloud.inputs.GetRegionsArgs;
    import com.pulumi.alicloud.vpc.Network;
    import com.pulumi.alicloud.vpc.NetworkArgs;
    import com.pulumi.alicloud.cen.Instance;
    import com.pulumi.alicloud.cen.InstanceArgs;
    import com.pulumi.alicloud.cen.InstanceAttachment;
    import com.pulumi.alicloud.cen.InstanceAttachmentArgs;
    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 default = AlicloudFunctions.getRegions(GetRegionsArgs.builder()
                .current(true)
                .build());
    
            var example = new Network("example", NetworkArgs.builder()
                .vpcName("tf_example")
                .cidrBlock("172.17.3.0/24")
                .build());
    
            var exampleInstance = new Instance("exampleInstance", InstanceArgs.builder()
                .cenInstanceName("tf_example")
                .description("an example for cen")
                .build());
    
            var exampleInstanceAttachment = new InstanceAttachment("exampleInstanceAttachment", InstanceAttachmentArgs.builder()
                .instanceId(exampleInstance.id())
                .childInstanceId(example.id())
                .childInstanceType("VPC")
                .childInstanceRegionId(default_.regions()[0].id())
                .build());
    
        }
    }
    
    resources:
      example:
        type: alicloud:vpc:Network
        properties:
          vpcName: tf_example
          cidrBlock: 172.17.3.0/24
      exampleInstance:
        type: alicloud:cen:Instance
        name: example
        properties:
          cenInstanceName: tf_example
          description: an example for cen
      exampleInstanceAttachment:
        type: alicloud:cen:InstanceAttachment
        name: example
        properties:
          instanceId: ${exampleInstance.id}
          childInstanceId: ${example.id}
          childInstanceType: VPC
          childInstanceRegionId: ${default.regions[0].id}
    variables:
      default:
        fn::invoke:
          Function: alicloud:getRegions
          Arguments:
            current: true
    

    Create InstanceAttachment Resource

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

    Constructor syntax

    new InstanceAttachment(name: string, args: InstanceAttachmentArgs, opts?: CustomResourceOptions);
    @overload
    def InstanceAttachment(resource_name: str,
                           args: InstanceAttachmentArgs,
                           opts: Optional[ResourceOptions] = None)
    
    @overload
    def InstanceAttachment(resource_name: str,
                           opts: Optional[ResourceOptions] = None,
                           child_instance_id: Optional[str] = None,
                           child_instance_region_id: Optional[str] = None,
                           child_instance_type: Optional[str] = None,
                           instance_id: Optional[str] = None,
                           cen_owner_id: Optional[int] = None,
                           child_instance_owner_id: Optional[int] = None)
    func NewInstanceAttachment(ctx *Context, name string, args InstanceAttachmentArgs, opts ...ResourceOption) (*InstanceAttachment, error)
    public InstanceAttachment(string name, InstanceAttachmentArgs args, CustomResourceOptions? opts = null)
    public InstanceAttachment(String name, InstanceAttachmentArgs args)
    public InstanceAttachment(String name, InstanceAttachmentArgs args, CustomResourceOptions options)
    
    type: alicloud:cen:InstanceAttachment
    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 InstanceAttachmentArgs
    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 InstanceAttachmentArgs
    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 InstanceAttachmentArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args InstanceAttachmentArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args InstanceAttachmentArgs
    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 instanceAttachmentResource = new AliCloud.Cen.InstanceAttachment("instanceAttachmentResource", new()
    {
        ChildInstanceId = "string",
        ChildInstanceRegionId = "string",
        ChildInstanceType = "string",
        InstanceId = "string",
        CenOwnerId = 0,
        ChildInstanceOwnerId = 0,
    });
    
    example, err := cen.NewInstanceAttachment(ctx, "instanceAttachmentResource", &cen.InstanceAttachmentArgs{
    	ChildInstanceId:       pulumi.String("string"),
    	ChildInstanceRegionId: pulumi.String("string"),
    	ChildInstanceType:     pulumi.String("string"),
    	InstanceId:            pulumi.String("string"),
    	CenOwnerId:            pulumi.Int(0),
    	ChildInstanceOwnerId:  pulumi.Int(0),
    })
    
    var instanceAttachmentResource = new InstanceAttachment("instanceAttachmentResource", InstanceAttachmentArgs.builder()
        .childInstanceId("string")
        .childInstanceRegionId("string")
        .childInstanceType("string")
        .instanceId("string")
        .cenOwnerId(0)
        .childInstanceOwnerId(0)
        .build());
    
    instance_attachment_resource = alicloud.cen.InstanceAttachment("instanceAttachmentResource",
        child_instance_id="string",
        child_instance_region_id="string",
        child_instance_type="string",
        instance_id="string",
        cen_owner_id=0,
        child_instance_owner_id=0)
    
    const instanceAttachmentResource = new alicloud.cen.InstanceAttachment("instanceAttachmentResource", {
        childInstanceId: "string",
        childInstanceRegionId: "string",
        childInstanceType: "string",
        instanceId: "string",
        cenOwnerId: 0,
        childInstanceOwnerId: 0,
    });
    
    type: alicloud:cen:InstanceAttachment
    properties:
        cenOwnerId: 0
        childInstanceId: string
        childInstanceOwnerId: 0
        childInstanceRegionId: string
        childInstanceType: string
        instanceId: string
    

    InstanceAttachment 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 InstanceAttachment resource accepts the following input properties:

    ChildInstanceId string
    The ID of the child instance to attach.
    ChildInstanceRegionId string
    The region ID of the child instance to attach.
    ChildInstanceType string
    The type of the associated network. Valid values: VPC, VBR and CCN.
    InstanceId string
    The ID of the CEN.
    CenOwnerId int

    The account ID to which the CEN instance belongs.

    ->NOTE: Ensure that the child instance is not used in Express Connect.

    ChildInstanceOwnerId int
    The uid of the child instance. Only used when attach a child instance of other account.
    ChildInstanceId string
    The ID of the child instance to attach.
    ChildInstanceRegionId string
    The region ID of the child instance to attach.
    ChildInstanceType string
    The type of the associated network. Valid values: VPC, VBR and CCN.
    InstanceId string
    The ID of the CEN.
    CenOwnerId int

    The account ID to which the CEN instance belongs.

    ->NOTE: Ensure that the child instance is not used in Express Connect.

    ChildInstanceOwnerId int
    The uid of the child instance. Only used when attach a child instance of other account.
    childInstanceId String
    The ID of the child instance to attach.
    childInstanceRegionId String
    The region ID of the child instance to attach.
    childInstanceType String
    The type of the associated network. Valid values: VPC, VBR and CCN.
    instanceId String
    The ID of the CEN.
    cenOwnerId Integer

    The account ID to which the CEN instance belongs.

    ->NOTE: Ensure that the child instance is not used in Express Connect.

    childInstanceOwnerId Integer
    The uid of the child instance. Only used when attach a child instance of other account.
    childInstanceId string
    The ID of the child instance to attach.
    childInstanceRegionId string
    The region ID of the child instance to attach.
    childInstanceType string
    The type of the associated network. Valid values: VPC, VBR and CCN.
    instanceId string
    The ID of the CEN.
    cenOwnerId number

    The account ID to which the CEN instance belongs.

    ->NOTE: Ensure that the child instance is not used in Express Connect.

    childInstanceOwnerId number
    The uid of the child instance. Only used when attach a child instance of other account.
    child_instance_id str
    The ID of the child instance to attach.
    child_instance_region_id str
    The region ID of the child instance to attach.
    child_instance_type str
    The type of the associated network. Valid values: VPC, VBR and CCN.
    instance_id str
    The ID of the CEN.
    cen_owner_id int

    The account ID to which the CEN instance belongs.

    ->NOTE: Ensure that the child instance is not used in Express Connect.

    child_instance_owner_id int
    The uid of the child instance. Only used when attach a child instance of other account.
    childInstanceId String
    The ID of the child instance to attach.
    childInstanceRegionId String
    The region ID of the child instance to attach.
    childInstanceType String
    The type of the associated network. Valid values: VPC, VBR and CCN.
    instanceId String
    The ID of the CEN.
    cenOwnerId Number

    The account ID to which the CEN instance belongs.

    ->NOTE: Ensure that the child instance is not used in Express Connect.

    childInstanceOwnerId Number
    The uid of the child instance. Only used when attach a child instance of other account.

    Outputs

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

    Id string
    The provider-assigned unique ID for this managed resource.
    Status string
    The associating status of the network.
    Id string
    The provider-assigned unique ID for this managed resource.
    Status string
    The associating status of the network.
    id String
    The provider-assigned unique ID for this managed resource.
    status String
    The associating status of the network.
    id string
    The provider-assigned unique ID for this managed resource.
    status string
    The associating status of the network.
    id str
    The provider-assigned unique ID for this managed resource.
    status str
    The associating status of the network.
    id String
    The provider-assigned unique ID for this managed resource.
    status String
    The associating status of the network.

    Look up Existing InstanceAttachment Resource

    Get an existing InstanceAttachment 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?: InstanceAttachmentState, opts?: CustomResourceOptions): InstanceAttachment
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            cen_owner_id: Optional[int] = None,
            child_instance_id: Optional[str] = None,
            child_instance_owner_id: Optional[int] = None,
            child_instance_region_id: Optional[str] = None,
            child_instance_type: Optional[str] = None,
            instance_id: Optional[str] = None,
            status: Optional[str] = None) -> InstanceAttachment
    func GetInstanceAttachment(ctx *Context, name string, id IDInput, state *InstanceAttachmentState, opts ...ResourceOption) (*InstanceAttachment, error)
    public static InstanceAttachment Get(string name, Input<string> id, InstanceAttachmentState? state, CustomResourceOptions? opts = null)
    public static InstanceAttachment get(String name, Output<String> id, InstanceAttachmentState 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:
    CenOwnerId int

    The account ID to which the CEN instance belongs.

    ->NOTE: Ensure that the child instance is not used in Express Connect.

    ChildInstanceId string
    The ID of the child instance to attach.
    ChildInstanceOwnerId int
    The uid of the child instance. Only used when attach a child instance of other account.
    ChildInstanceRegionId string
    The region ID of the child instance to attach.
    ChildInstanceType string
    The type of the associated network. Valid values: VPC, VBR and CCN.
    InstanceId string
    The ID of the CEN.
    Status string
    The associating status of the network.
    CenOwnerId int

    The account ID to which the CEN instance belongs.

    ->NOTE: Ensure that the child instance is not used in Express Connect.

    ChildInstanceId string
    The ID of the child instance to attach.
    ChildInstanceOwnerId int
    The uid of the child instance. Only used when attach a child instance of other account.
    ChildInstanceRegionId string
    The region ID of the child instance to attach.
    ChildInstanceType string
    The type of the associated network. Valid values: VPC, VBR and CCN.
    InstanceId string
    The ID of the CEN.
    Status string
    The associating status of the network.
    cenOwnerId Integer

    The account ID to which the CEN instance belongs.

    ->NOTE: Ensure that the child instance is not used in Express Connect.

    childInstanceId String
    The ID of the child instance to attach.
    childInstanceOwnerId Integer
    The uid of the child instance. Only used when attach a child instance of other account.
    childInstanceRegionId String
    The region ID of the child instance to attach.
    childInstanceType String
    The type of the associated network. Valid values: VPC, VBR and CCN.
    instanceId String
    The ID of the CEN.
    status String
    The associating status of the network.
    cenOwnerId number

    The account ID to which the CEN instance belongs.

    ->NOTE: Ensure that the child instance is not used in Express Connect.

    childInstanceId string
    The ID of the child instance to attach.
    childInstanceOwnerId number
    The uid of the child instance. Only used when attach a child instance of other account.
    childInstanceRegionId string
    The region ID of the child instance to attach.
    childInstanceType string
    The type of the associated network. Valid values: VPC, VBR and CCN.
    instanceId string
    The ID of the CEN.
    status string
    The associating status of the network.
    cen_owner_id int

    The account ID to which the CEN instance belongs.

    ->NOTE: Ensure that the child instance is not used in Express Connect.

    child_instance_id str
    The ID of the child instance to attach.
    child_instance_owner_id int
    The uid of the child instance. Only used when attach a child instance of other account.
    child_instance_region_id str
    The region ID of the child instance to attach.
    child_instance_type str
    The type of the associated network. Valid values: VPC, VBR and CCN.
    instance_id str
    The ID of the CEN.
    status str
    The associating status of the network.
    cenOwnerId Number

    The account ID to which the CEN instance belongs.

    ->NOTE: Ensure that the child instance is not used in Express Connect.

    childInstanceId String
    The ID of the child instance to attach.
    childInstanceOwnerId Number
    The uid of the child instance. Only used when attach a child instance of other account.
    childInstanceRegionId String
    The region ID of the child instance to attach.
    childInstanceType String
    The type of the associated network. Valid values: VPC, VBR and CCN.
    instanceId String
    The ID of the CEN.
    status String
    The associating status of the network.

    Import

    CEN instance can be imported using the id, e.g.

    $ pulumi import alicloud:cen/instanceAttachment:InstanceAttachment example cen-m7i7pjmkon********:vpc-2ze2w07mcy9nz********:VPC:cn-beijing
    

    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.62.1 published on Monday, Sep 16, 2024 by Pulumi