1. Packages
  2. Alibaba Cloud
  3. API Docs
  4. cen
  5. PrivateZone
Alibaba Cloud v3.57.1 published on Wednesday, Jun 26, 2024 by Pulumi

alicloud.cen.PrivateZone

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.57.1 published on Wednesday, Jun 26, 2024 by Pulumi

    This topic describes how to configure PrivateZone access. PrivateZone is a VPC-based resolution and management service for private domain names. After you set a PrivateZone access, the Cloud Connect Network (CCN) and Virtual Border Router (VBR) attached to a CEN instance can access the PrivateZone service through CEN.

    For information about CEN Private Zone and how to use it, see Manage CEN 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 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),
    });
    const defaultPrivateZone = new alicloud.cen.PrivateZone("default", {
        accessRegionId: _default.then(_default => _default.regions?.[0]?.id),
        cenId: exampleInstanceAttachment.instanceId,
        hostRegionId: _default.then(_default => _default.regions?.[0]?.id),
        hostVpcId: example.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)
    default_private_zone = alicloud.cen.PrivateZone("default",
        access_region_id=default.regions[0].id,
        cen_id=example_instance_attachment.instance_id,
        host_region_id=default.regions[0].id,
        host_vpc_id=example.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
    		}
    		exampleInstanceAttachment, 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
    		}
    		_, err = cen.NewPrivateZone(ctx, "default", &cen.PrivateZoneArgs{
    			AccessRegionId: pulumi.String(_default.Regions[0].Id),
    			CenId:          exampleInstanceAttachment.InstanceId,
    			HostRegionId:   pulumi.String(_default.Regions[0].Id),
    			HostVpcId:      example.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)),
        });
    
        var defaultPrivateZone = new AliCloud.Cen.PrivateZone("default", new()
        {
            AccessRegionId = @default.Apply(@default => @default.Apply(getRegionsResult => getRegionsResult.Regions[0]?.Id)),
            CenId = exampleInstanceAttachment.InstanceId,
            HostRegionId = @default.Apply(@default => @default.Apply(getRegionsResult => getRegionsResult.Regions[0]?.Id)),
            HostVpcId = example.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 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 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());
    
            var defaultPrivateZone = new PrivateZone("defaultPrivateZone", PrivateZoneArgs.builder()
                .accessRegionId(default_.regions()[0].id())
                .cenId(exampleInstanceAttachment.instanceId())
                .hostRegionId(default_.regions()[0].id())
                .hostVpcId(example.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}
      defaultPrivateZone:
        type: alicloud:cen:PrivateZone
        name: default
        properties:
          accessRegionId: ${default.regions[0].id}
          cenId: ${exampleInstanceAttachment.instanceId}
          hostRegionId: ${default.regions[0].id}
          hostVpcId: ${example.id}
    variables:
      default:
        fn::invoke:
          Function: alicloud:getRegions
          Arguments:
            current: true
    

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

    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

    The PrivateZone resource accepts the following input properties:

    AccessRegionId string
    The access region. The access region is the region of the cloud resource that accesses the PrivateZone service through CEN.
    CenId string
    The ID of the CEN instance.
    HostRegionId string
    The service region. The service region is the target region of the PrivateZone service to be accessed through CEN.
    HostVpcId string

    The VPC that belongs to the service region.

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

    AccessRegionId string
    The access region. The access region is the region of the cloud resource that accesses the PrivateZone service through CEN.
    CenId string
    The ID of the CEN instance.
    HostRegionId string
    The service region. The service region is the target region of the PrivateZone service to be accessed through CEN.
    HostVpcId string

    The VPC that belongs to the service region.

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

    accessRegionId String
    The access region. The access region is the region of the cloud resource that accesses the PrivateZone service through CEN.
    cenId String
    The ID of the CEN instance.
    hostRegionId String
    The service region. The service region is the target region of the PrivateZone service to be accessed through CEN.
    hostVpcId String

    The VPC that belongs to the service region.

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

    accessRegionId string
    The access region. The access region is the region of the cloud resource that accesses the PrivateZone service through CEN.
    cenId string
    The ID of the CEN instance.
    hostRegionId string
    The service region. The service region is the target region of the PrivateZone service to be accessed through CEN.
    hostVpcId string

    The VPC that belongs to the service region.

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

    access_region_id str
    The access region. The access region is the region of the cloud resource that accesses the PrivateZone service through CEN.
    cen_id str
    The ID of the CEN instance.
    host_region_id str
    The service region. The service region is the target region of the PrivateZone service to be accessed through CEN.
    host_vpc_id str

    The VPC that belongs to the service region.

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

    accessRegionId String
    The access region. The access region is the region of the cloud resource that accesses the PrivateZone service through CEN.
    cenId String
    The ID of the CEN instance.
    hostRegionId String
    The service region. The service region is the target region of the PrivateZone service to be accessed through CEN.
    hostVpcId String

    The VPC that belongs to the service region.

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

    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 PrivateZone service. Valid values: ["Creating", "Active", "Deleting"].
    Id string
    The provider-assigned unique ID for this managed resource.
    Status string
    The status of the PrivateZone service. Valid values: ["Creating", "Active", "Deleting"].
    id String
    The provider-assigned unique ID for this managed resource.
    status String
    The status of the PrivateZone service. Valid values: ["Creating", "Active", "Deleting"].
    id string
    The provider-assigned unique ID for this managed resource.
    status string
    The status of the PrivateZone service. Valid values: ["Creating", "Active", "Deleting"].
    id str
    The provider-assigned unique ID for this managed resource.
    status str
    The status of the PrivateZone service. Valid values: ["Creating", "Active", "Deleting"].
    id String
    The provider-assigned unique ID for this managed resource.
    status String
    The status of the PrivateZone service. Valid values: ["Creating", "Active", "Deleting"].

    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)
    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:
    AccessRegionId string
    The access region. The access region is the region of the cloud resource that accesses the PrivateZone service through CEN.
    CenId string
    The ID of the CEN instance.
    HostRegionId string
    The service region. The service region is the target region of the PrivateZone service to be accessed through CEN.
    HostVpcId string

    The VPC that belongs to the service region.

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

    Status string
    The status of the PrivateZone service. Valid values: ["Creating", "Active", "Deleting"].
    AccessRegionId string
    The access region. The access region is the region of the cloud resource that accesses the PrivateZone service through CEN.
    CenId string
    The ID of the CEN instance.
    HostRegionId string
    The service region. The service region is the target region of the PrivateZone service to be accessed through CEN.
    HostVpcId string

    The VPC that belongs to the service region.

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

    Status string
    The status of the PrivateZone service. Valid values: ["Creating", "Active", "Deleting"].
    accessRegionId String
    The access region. The access region is the region of the cloud resource that accesses the PrivateZone service through CEN.
    cenId String
    The ID of the CEN instance.
    hostRegionId String
    The service region. The service region is the target region of the PrivateZone service to be accessed through CEN.
    hostVpcId String

    The VPC that belongs to the service region.

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

    status String
    The status of the PrivateZone service. Valid values: ["Creating", "Active", "Deleting"].
    accessRegionId string
    The access region. The access region is the region of the cloud resource that accesses the PrivateZone service through CEN.
    cenId string
    The ID of the CEN instance.
    hostRegionId string
    The service region. The service region is the target region of the PrivateZone service to be accessed through CEN.
    hostVpcId string

    The VPC that belongs to the service region.

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

    status string
    The status of the PrivateZone service. Valid values: ["Creating", "Active", "Deleting"].
    access_region_id str
    The access region. The access region is the region of the cloud resource that accesses the PrivateZone service through CEN.
    cen_id str
    The ID of the CEN instance.
    host_region_id str
    The service region. The service region is the target region of the PrivateZone service to be accessed through CEN.
    host_vpc_id str

    The VPC that belongs to the service region.

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

    status str
    The status of the PrivateZone service. Valid values: ["Creating", "Active", "Deleting"].
    accessRegionId String
    The access region. The access region is the region of the cloud resource that accesses the PrivateZone service through CEN.
    cenId String
    The ID of the CEN instance.
    hostRegionId String
    The service region. The service region is the target region of the PrivateZone service to be accessed through CEN.
    hostVpcId String

    The VPC that belongs to the service region.

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

    status String
    The status of the PrivateZone service. Valid values: ["Creating", "Active", "Deleting"].

    Import

    CEN Private Zone can be imported using the id, e.g.

    $ pulumi import alicloud:cen/privateZone:PrivateZone example cen-abc123456:cn-hangzhou
    

    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.57.1 published on Wednesday, Jun 26, 2024 by Pulumi