alicloud logo
Alibaba Cloud v3.34.0, Mar 17 23

alicloud.cen.InstanceAttachment

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

->NOTE: Available in 1.42.0+

Example Usage

Basic Usage

using System.Collections.Generic;
using Pulumi;
using AliCloud = Pulumi.AliCloud;

return await Deployment.RunAsync(() => 
{
    var config = new Config();
    var name = config.Get("name") ?? "tf-testAccCenInstanceAttachmentBasic";
    var cen = new AliCloud.Cen.Instance("cen", new()
    {
        Description = "terraform01",
    });

    var vpc = new AliCloud.Vpc.Network("vpc", new()
    {
        CidrBlock = "192.168.0.0/16",
    });

    var foo = new AliCloud.Cen.InstanceAttachment("foo", new()
    {
        InstanceId = cen.Id,
        ChildInstanceId = vpc.Id,
        ChildInstanceType = "VPC",
        ChildInstanceRegionId = "cn-beijing",
    });

});
package main

import (
	"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"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		cfg := config.New(ctx, "")
		name := "tf-testAccCenInstanceAttachmentBasic"
		if param := cfg.Get("name"); param != "" {
			name = param
		}
		cen, err := cen.NewInstance(ctx, "cen", &cen.InstanceArgs{
			Description: pulumi.String("terraform01"),
		})
		if err != nil {
			return err
		}
		vpc, err := vpc.NewNetwork(ctx, "vpc", &vpc.NetworkArgs{
			CidrBlock: pulumi.String("192.168.0.0/16"),
		})
		if err != nil {
			return err
		}
		_, err = cen.NewInstanceAttachment(ctx, "foo", &cen.InstanceAttachmentArgs{
			InstanceId:            cen.ID(),
			ChildInstanceId:       vpc.ID(),
			ChildInstanceType:     pulumi.String("VPC"),
			ChildInstanceRegionId: pulumi.String("cn-beijing"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.cen.Instance;
import com.pulumi.alicloud.cen.InstanceArgs;
import com.pulumi.alicloud.vpc.Network;
import com.pulumi.alicloud.vpc.NetworkArgs;
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 config = ctx.config();
        final var name = config.get("name").orElse("tf-testAccCenInstanceAttachmentBasic");
        var cen = new Instance("cen", InstanceArgs.builder()        
            .description("terraform01")
            .build());

        var vpc = new Network("vpc", NetworkArgs.builder()        
            .cidrBlock("192.168.0.0/16")
            .build());

        var foo = new InstanceAttachment("foo", InstanceAttachmentArgs.builder()        
            .instanceId(cen.id())
            .childInstanceId(vpc.id())
            .childInstanceType("VPC")
            .childInstanceRegionId("cn-beijing")
            .build());

    }
}
import pulumi
import pulumi_alicloud as alicloud

config = pulumi.Config()
name = config.get("name")
if name is None:
    name = "tf-testAccCenInstanceAttachmentBasic"
cen = alicloud.cen.Instance("cen", description="terraform01")
vpc = alicloud.vpc.Network("vpc", cidr_block="192.168.0.0/16")
foo = alicloud.cen.InstanceAttachment("foo",
    instance_id=cen.id,
    child_instance_id=vpc.id,
    child_instance_type="VPC",
    child_instance_region_id="cn-beijing")
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";

const config = new pulumi.Config();
const name = config.get("name") || "tf-testAccCenInstanceAttachmentBasic";
const cen = new alicloud.cen.Instance("cen", {description: "terraform01"});
const vpc = new alicloud.vpc.Network("vpc", {cidrBlock: "192.168.0.0/16"});
const foo = new alicloud.cen.InstanceAttachment("foo", {
    instanceId: cen.id,
    childInstanceId: vpc.id,
    childInstanceType: "VPC",
    childInstanceRegionId: "cn-beijing",
});
configuration:
  # Create a new instance-attachment and use it to attach one child instance to a new CEN
  name:
    type: string
    default: tf-testAccCenInstanceAttachmentBasic
resources:
  cen:
    type: alicloud:cen:Instance
    properties:
      description: terraform01
  vpc:
    type: alicloud:vpc:Network
    properties:
      cidrBlock: 192.168.0.0/16
  foo:
    type: alicloud:cen:InstanceAttachment
    properties:
      instanceId: ${cen.id}
      childInstanceId: ${vpc.id}
      childInstanceType: VPC
      childInstanceRegionId: cn-beijing

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.