1. Packages
  2. Alibaba Cloud Provider
  3. API Docs
  4. cen
  5. PrivateZone
Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi

alicloud.cen.PrivateZone

Explore with Pulumi AI

Provides a Cloud Enterprise Network (CEN) Private Zone resource.

For information about Cloud Enterprise Network (CEN) Private Zone and how to use it, see What is Private Zone.

NOTE: Available since v1.83.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 = alicloud.getRegions({
    current: true,
});
const defaultNetwork = new alicloud.vpc.Network("default", {
    vpcName: name,
    cidrBlock: "172.17.3.0/24",
});
const defaultInstance = new alicloud.cen.Instance("default", {
    cenInstanceName: name,
    description: name,
});
const defaultInstanceAttachment = new alicloud.cen.InstanceAttachment("default", {
    instanceId: defaultInstance.id,
    childInstanceId: defaultNetwork.id,
    childInstanceType: "VPC",
    childInstanceRegionId: _default.then(_default => _default.regions?.[0]?.id),
});
const defaultPrivateZone = new alicloud.cen.PrivateZone("default", {
    cenId: defaultInstanceAttachment.instanceId,
    accessRegionId: _default.then(_default => _default.regions?.[0]?.id),
    hostVpcId: defaultNetwork.id,
    hostRegionId: _default.then(_default => _default.regions?.[0]?.id),
});
Copy
import pulumi
import pulumi_alicloud as alicloud

config = pulumi.Config()
name = config.get("name")
if name is None:
    name = "terraform-example"
default = alicloud.get_regions(current=True)
default_network = alicloud.vpc.Network("default",
    vpc_name=name,
    cidr_block="172.17.3.0/24")
default_instance = alicloud.cen.Instance("default",
    cen_instance_name=name,
    description=name)
default_instance_attachment = alicloud.cen.InstanceAttachment("default",
    instance_id=default_instance.id,
    child_instance_id=default_network.id,
    child_instance_type="VPC",
    child_instance_region_id=default.regions[0].id)
default_private_zone = alicloud.cen.PrivateZone("default",
    cen_id=default_instance_attachment.instance_id,
    access_region_id=default.regions[0].id,
    host_vpc_id=default_network.id,
    host_region_id=default.regions[0].id)
Copy
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"
	"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
		}
		_default, err := alicloud.GetRegions(ctx, &alicloud.GetRegionsArgs{
			Current: pulumi.BoolRef(true),
		}, nil)
		if err != nil {
			return err
		}
		defaultNetwork, err := vpc.NewNetwork(ctx, "default", &vpc.NetworkArgs{
			VpcName:   pulumi.String(name),
			CidrBlock: pulumi.String("172.17.3.0/24"),
		})
		if err != nil {
			return err
		}
		defaultInstance, err := cen.NewInstance(ctx, "default", &cen.InstanceArgs{
			CenInstanceName: pulumi.String(name),
			Description:     pulumi.String(name),
		})
		if err != nil {
			return err
		}
		defaultInstanceAttachment, err := cen.NewInstanceAttachment(ctx, "default", &cen.InstanceAttachmentArgs{
			InstanceId:            defaultInstance.ID(),
			ChildInstanceId:       defaultNetwork.ID(),
			ChildInstanceType:     pulumi.String("VPC"),
			ChildInstanceRegionId: pulumi.String(_default.Regions[0].Id),
		})
		if err != nil {
			return err
		}
		_, err = cen.NewPrivateZone(ctx, "default", &cen.PrivateZoneArgs{
			CenId:          defaultInstanceAttachment.InstanceId,
			AccessRegionId: pulumi.String(_default.Regions[0].Id),
			HostVpcId:      defaultNetwork.ID(),
			HostRegionId:   pulumi.String(_default.Regions[0].Id),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
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 = AliCloud.GetRegions.Invoke(new()
    {
        Current = true,
    });

    var defaultNetwork = new AliCloud.Vpc.Network("default", new()
    {
        VpcName = name,
        CidrBlock = "172.17.3.0/24",
    });

    var defaultInstance = new AliCloud.Cen.Instance("default", new()
    {
        CenInstanceName = name,
        Description = name,
    });

    var defaultInstanceAttachment = new AliCloud.Cen.InstanceAttachment("default", new()
    {
        InstanceId = defaultInstance.Id,
        ChildInstanceId = defaultNetwork.Id,
        ChildInstanceType = "VPC",
        ChildInstanceRegionId = @default.Apply(@default => @default.Apply(getRegionsResult => getRegionsResult.Regions[0]?.Id)),
    });

    var defaultPrivateZone = new AliCloud.Cen.PrivateZone("default", new()
    {
        CenId = defaultInstanceAttachment.InstanceId,
        AccessRegionId = @default.Apply(@default => @default.Apply(getRegionsResult => getRegionsResult.Regions[0]?.Id)),
        HostVpcId = defaultNetwork.Id,
        HostRegionId = @default.Apply(@default => @default.Apply(getRegionsResult => getRegionsResult.Regions[0]?.Id)),
    });

});
Copy
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 com.pulumi.alicloud.cen.PrivateZone;
import com.pulumi.alicloud.cen.PrivateZoneArgs;
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");
        final var default = AlicloudFunctions.getRegions(GetRegionsArgs.builder()
            .current(true)
            .build());

        var defaultNetwork = new Network("defaultNetwork", NetworkArgs.builder()
            .vpcName(name)
            .cidrBlock("172.17.3.0/24")
            .build());

        var defaultInstance = new Instance("defaultInstance", InstanceArgs.builder()
            .cenInstanceName(name)
            .description(name)
            .build());

        var defaultInstanceAttachment = new InstanceAttachment("defaultInstanceAttachment", InstanceAttachmentArgs.builder()
            .instanceId(defaultInstance.id())
            .childInstanceId(defaultNetwork.id())
            .childInstanceType("VPC")
            .childInstanceRegionId(default_.regions()[0].id())
            .build());

        var defaultPrivateZone = new PrivateZone("defaultPrivateZone", PrivateZoneArgs.builder()
            .cenId(defaultInstanceAttachment.instanceId())
            .accessRegionId(default_.regions()[0].id())
            .hostVpcId(defaultNetwork.id())
            .hostRegionId(default_.regions()[0].id())
            .build());

    }
}
Copy
configuration:
  name:
    type: string
    default: terraform-example
resources:
  defaultNetwork:
    type: alicloud:vpc:Network
    name: default
    properties:
      vpcName: ${name}
      cidrBlock: 172.17.3.0/24
  defaultInstance:
    type: alicloud:cen:Instance
    name: default
    properties:
      cenInstanceName: ${name}
      description: ${name}
  defaultInstanceAttachment:
    type: alicloud:cen:InstanceAttachment
    name: default
    properties:
      instanceId: ${defaultInstance.id}
      childInstanceId: ${defaultNetwork.id}
      childInstanceType: VPC
      childInstanceRegionId: ${default.regions[0].id}
  defaultPrivateZone:
    type: alicloud:cen:PrivateZone
    name: default
    properties:
      cenId: ${defaultInstanceAttachment.instanceId}
      accessRegionId: ${default.regions[0].id}
      hostVpcId: ${defaultNetwork.id}
      hostRegionId: ${default.regions[0].id}
variables:
  default:
    fn::invoke:
      function: alicloud:getRegions
      arguments:
        current: true
Copy

Create PrivateZone Resource

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

Constructor syntax

new PrivateZone(name: string, args: PrivateZoneArgs, opts?: CustomResourceOptions);
@overload
def PrivateZone(resource_name: str,
                args: PrivateZoneArgs,
                opts: Optional[ResourceOptions] = None)

@overload
def PrivateZone(resource_name: str,
                opts: Optional[ResourceOptions] = None,
                access_region_id: Optional[str] = None,
                cen_id: Optional[str] = None,
                host_region_id: Optional[str] = None,
                host_vpc_id: Optional[str] = None)
func NewPrivateZone(ctx *Context, name string, args PrivateZoneArgs, opts ...ResourceOption) (*PrivateZone, error)
public PrivateZone(string name, PrivateZoneArgs args, CustomResourceOptions? opts = null)
public PrivateZone(String name, PrivateZoneArgs args)
public PrivateZone(String name, PrivateZoneArgs args, CustomResourceOptions options)
type: alicloud:cen:PrivateZone
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. PrivateZoneArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. PrivateZoneArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. PrivateZoneArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. PrivateZoneArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. PrivateZoneArgs
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 privateZoneResource = new AliCloud.Cen.PrivateZone("privateZoneResource", new()
{
    AccessRegionId = "string",
    CenId = "string",
    HostRegionId = "string",
    HostVpcId = "string",
});
Copy
example, err := cen.NewPrivateZone(ctx, "privateZoneResource", &cen.PrivateZoneArgs{
	AccessRegionId: pulumi.String("string"),
	CenId:          pulumi.String("string"),
	HostRegionId:   pulumi.String("string"),
	HostVpcId:      pulumi.String("string"),
})
Copy
var privateZoneResource = new PrivateZone("privateZoneResource", PrivateZoneArgs.builder()
    .accessRegionId("string")
    .cenId("string")
    .hostRegionId("string")
    .hostVpcId("string")
    .build());
Copy
private_zone_resource = alicloud.cen.PrivateZone("privateZoneResource",
    access_region_id="string",
    cen_id="string",
    host_region_id="string",
    host_vpc_id="string")
Copy
const privateZoneResource = new alicloud.cen.PrivateZone("privateZoneResource", {
    accessRegionId: "string",
    cenId: "string",
    hostRegionId: "string",
    hostVpcId: "string",
});
Copy
type: alicloud:cen:PrivateZone
properties:
    accessRegionId: string
    cenId: string
    hostRegionId: string
    hostVpcId: string
Copy

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

AccessRegionId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the region where PrivateZone is accessed. This region refers to the region in which PrivateZone is accessed by clients.
CenId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the CEN instance.
HostRegionId
This property is required.
Changes to this property will trigger replacement.
string

The ID of the region where PrivateZone is deployed.

->NOTE: The resource alicloud.cen.PrivateZone depends on the resource alicloud.cen.InstanceAttachment.

HostVpcId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the VPC that is associated with PrivateZone.
AccessRegionId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the region where PrivateZone is accessed. This region refers to the region in which PrivateZone is accessed by clients.
CenId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the CEN instance.
HostRegionId
This property is required.
Changes to this property will trigger replacement.
string

The ID of the region where PrivateZone is deployed.

->NOTE: The resource alicloud.cen.PrivateZone depends on the resource alicloud.cen.InstanceAttachment.

HostVpcId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the VPC that is associated with PrivateZone.
accessRegionId
This property is required.
Changes to this property will trigger replacement.
String
The ID of the region where PrivateZone is accessed. This region refers to the region in which PrivateZone is accessed by clients.
cenId
This property is required.
Changes to this property will trigger replacement.
String
The ID of the CEN instance.
hostRegionId
This property is required.
Changes to this property will trigger replacement.
String

The ID of the region where PrivateZone is deployed.

->NOTE: The resource alicloud.cen.PrivateZone depends on the resource alicloud.cen.InstanceAttachment.

hostVpcId
This property is required.
Changes to this property will trigger replacement.
String
The ID of the VPC that is associated with PrivateZone.
accessRegionId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the region where PrivateZone is accessed. This region refers to the region in which PrivateZone is accessed by clients.
cenId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the CEN instance.
hostRegionId
This property is required.
Changes to this property will trigger replacement.
string

The ID of the region where PrivateZone is deployed.

->NOTE: The resource alicloud.cen.PrivateZone depends on the resource alicloud.cen.InstanceAttachment.

hostVpcId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the VPC that is associated with PrivateZone.
access_region_id
This property is required.
Changes to this property will trigger replacement.
str
The ID of the region where PrivateZone is accessed. This region refers to the region in which PrivateZone is accessed by clients.
cen_id
This property is required.
Changes to this property will trigger replacement.
str
The ID of the CEN instance.
host_region_id
This property is required.
Changes to this property will trigger replacement.
str

The ID of the region where PrivateZone is deployed.

->NOTE: The resource alicloud.cen.PrivateZone depends on the resource alicloud.cen.InstanceAttachment.

host_vpc_id
This property is required.
Changes to this property will trigger replacement.
str
The ID of the VPC that is associated with PrivateZone.
accessRegionId
This property is required.
Changes to this property will trigger replacement.
String
The ID of the region where PrivateZone is accessed. This region refers to the region in which PrivateZone is accessed by clients.
cenId
This property is required.
Changes to this property will trigger replacement.
String
The ID of the CEN instance.
hostRegionId
This property is required.
Changes to this property will trigger replacement.
String

The ID of the region where PrivateZone is deployed.

->NOTE: The resource alicloud.cen.PrivateZone depends on the resource alicloud.cen.InstanceAttachment.

hostVpcId
This property is required.
Changes to this property will trigger replacement.
String
The ID of the VPC that is associated with PrivateZone.

Outputs

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

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

Look up Existing PrivateZone Resource

Get an existing PrivateZone 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?: PrivateZoneState, opts?: CustomResourceOptions): PrivateZone
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        access_region_id: Optional[str] = None,
        cen_id: Optional[str] = None,
        host_region_id: Optional[str] = None,
        host_vpc_id: Optional[str] = None,
        status: Optional[str] = None) -> PrivateZone
func GetPrivateZone(ctx *Context, name string, id IDInput, state *PrivateZoneState, opts ...ResourceOption) (*PrivateZone, error)
public static PrivateZone Get(string name, Input<string> id, PrivateZoneState? state, CustomResourceOptions? opts = null)
public static PrivateZone get(String name, Output<String> id, PrivateZoneState state, CustomResourceOptions options)
resources:  _:    type: alicloud:cen:PrivateZone    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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:
AccessRegionId Changes to this property will trigger replacement. string
The ID of the region where PrivateZone is accessed. This region refers to the region in which PrivateZone is accessed by clients.
CenId Changes to this property will trigger replacement. string
The ID of the CEN instance.
HostRegionId Changes to this property will trigger replacement. string

The ID of the region where PrivateZone is deployed.

->NOTE: The resource alicloud.cen.PrivateZone depends on the resource alicloud.cen.InstanceAttachment.

HostVpcId Changes to this property will trigger replacement. string
The ID of the VPC that is associated with PrivateZone.
Status string
The status of the Private Zone.
AccessRegionId Changes to this property will trigger replacement. string
The ID of the region where PrivateZone is accessed. This region refers to the region in which PrivateZone is accessed by clients.
CenId Changes to this property will trigger replacement. string
The ID of the CEN instance.
HostRegionId Changes to this property will trigger replacement. string

The ID of the region where PrivateZone is deployed.

->NOTE: The resource alicloud.cen.PrivateZone depends on the resource alicloud.cen.InstanceAttachment.

HostVpcId Changes to this property will trigger replacement. string
The ID of the VPC that is associated with PrivateZone.
Status string
The status of the Private Zone.
accessRegionId Changes to this property will trigger replacement. String
The ID of the region where PrivateZone is accessed. This region refers to the region in which PrivateZone is accessed by clients.
cenId Changes to this property will trigger replacement. String
The ID of the CEN instance.
hostRegionId Changes to this property will trigger replacement. String

The ID of the region where PrivateZone is deployed.

->NOTE: The resource alicloud.cen.PrivateZone depends on the resource alicloud.cen.InstanceAttachment.

hostVpcId Changes to this property will trigger replacement. String
The ID of the VPC that is associated with PrivateZone.
status String
The status of the Private Zone.
accessRegionId Changes to this property will trigger replacement. string
The ID of the region where PrivateZone is accessed. This region refers to the region in which PrivateZone is accessed by clients.
cenId Changes to this property will trigger replacement. string
The ID of the CEN instance.
hostRegionId Changes to this property will trigger replacement. string

The ID of the region where PrivateZone is deployed.

->NOTE: The resource alicloud.cen.PrivateZone depends on the resource alicloud.cen.InstanceAttachment.

hostVpcId Changes to this property will trigger replacement. string
The ID of the VPC that is associated with PrivateZone.
status string
The status of the Private Zone.
access_region_id Changes to this property will trigger replacement. str
The ID of the region where PrivateZone is accessed. This region refers to the region in which PrivateZone is accessed by clients.
cen_id Changes to this property will trigger replacement. str
The ID of the CEN instance.
host_region_id Changes to this property will trigger replacement. str

The ID of the region where PrivateZone is deployed.

->NOTE: The resource alicloud.cen.PrivateZone depends on the resource alicloud.cen.InstanceAttachment.

host_vpc_id Changes to this property will trigger replacement. str
The ID of the VPC that is associated with PrivateZone.
status str
The status of the Private Zone.
accessRegionId Changes to this property will trigger replacement. String
The ID of the region where PrivateZone is accessed. This region refers to the region in which PrivateZone is accessed by clients.
cenId Changes to this property will trigger replacement. String
The ID of the CEN instance.
hostRegionId Changes to this property will trigger replacement. String

The ID of the region where PrivateZone is deployed.

->NOTE: The resource alicloud.cen.PrivateZone depends on the resource alicloud.cen.InstanceAttachment.

hostVpcId Changes to this property will trigger replacement. String
The ID of the VPC that is associated with PrivateZone.
status String
The status of the Private Zone.

Import

Cloud Enterprise Network (CEN) Private Zone can be imported using the id, e.g.

$ pulumi import alicloud:cen/privateZone:PrivateZone example <cen_id>:<access_region_id>
Copy

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.