1. Packages
  2. Alibaba Cloud
  3. API Docs
  4. cen
  5. InstanceAttachment
Alibaba Cloud v3.51.0 published on Saturday, Mar 23, 2024 by Pulumi

alicloud.cen.InstanceAttachment

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.51.0 published on Saturday, Mar 23, 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 exampleNetwork = new alicloud.vpc.Network("exampleNetwork", {
        vpcName: "tf_example",
        cidrBlock: "172.17.3.0/24",
    });
    const exampleInstance = new alicloud.cen.Instance("exampleInstance", {
        cenInstanceName: "tf_example",
        description: "an example for cen",
    });
    const exampleInstanceAttachment = new alicloud.cen.InstanceAttachment("exampleInstanceAttachment", {
        instanceId: exampleInstance.id,
        childInstanceId: exampleNetwork.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_network = alicloud.vpc.Network("exampleNetwork",
        vpc_name="tf_example",
        cidr_block="172.17.3.0/24")
    example_instance = alicloud.cen.Instance("exampleInstance",
        cen_instance_name="tf_example",
        description="an example for cen")
    example_instance_attachment = alicloud.cen.InstanceAttachment("exampleInstanceAttachment",
        instance_id=example_instance.id,
        child_instance_id=example_network.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
    		}
    		exampleNetwork, err := vpc.NewNetwork(ctx, "exampleNetwork", &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, "exampleInstance", &cen.InstanceArgs{
    			CenInstanceName: pulumi.String("tf_example"),
    			Description:     pulumi.String("an example for cen"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = cen.NewInstanceAttachment(ctx, "exampleInstanceAttachment", &cen.InstanceAttachmentArgs{
    			InstanceId:            exampleInstance.ID(),
    			ChildInstanceId:       exampleNetwork.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 exampleNetwork = new AliCloud.Vpc.Network("exampleNetwork", new()
        {
            VpcName = "tf_example",
            CidrBlock = "172.17.3.0/24",
        });
    
        var exampleInstance = new AliCloud.Cen.Instance("exampleInstance", new()
        {
            CenInstanceName = "tf_example",
            Description = "an example for cen",
        });
    
        var exampleInstanceAttachment = new AliCloud.Cen.InstanceAttachment("exampleInstanceAttachment", new()
        {
            InstanceId = exampleInstance.Id,
            ChildInstanceId = exampleNetwork.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 exampleNetwork = new Network("exampleNetwork", 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(exampleNetwork.id())
                .childInstanceType("VPC")
                .childInstanceRegionId(default_.regions()[0].id())
                .build());
    
        }
    }
    
    resources:
      exampleNetwork:
        type: alicloud:vpc:Network
        properties:
          vpcName: tf_example
          cidrBlock: 172.17.3.0/24
      exampleInstance:
        type: alicloud:cen:Instance
        properties:
          cenInstanceName: tf_example
          description: an example for cen
      exampleInstanceAttachment:
        type: alicloud:cen:InstanceAttachment
        properties:
          instanceId: ${exampleInstance.id}
          childInstanceId: ${exampleNetwork.id}
          childInstanceType: VPC
          childInstanceRegionId: ${default.regions[0].id}
    variables:
      default:
        fn::invoke:
          Function: alicloud:getRegions
          Arguments:
            current: true
    

    Create InstanceAttachment Resource

    new InstanceAttachment(name: string, args: InstanceAttachmentArgs, opts?: CustomResourceOptions);
    @overload
    def InstanceAttachment(resource_name: 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)
    @overload
    def InstanceAttachment(resource_name: str,
                           args: InstanceAttachmentArgs,
                           opts: Optional[ResourceOptions] = 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.
    
    
    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.

    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
    

    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.51.0 published on Saturday, Mar 23, 2024 by Pulumi