Alibaba Cloud

Pulumi Official
Package maintained by Pulumi
v3.19.0 published on Friday, Mar 18, 2022 by Pulumi

Endpoint

Provides a PolarDB endpoint resource to manage endpoint of PolarDB cluster.

NOTE: After v1.80.0 and before v1.121.0, you can only use this resource to manage the custom endpoint. Since v1.121.0, you also can import the primary endpoint and the cluster endpoint, to modify their ssl status and so on.

NOTE: The primary endpoint and the default cluster endpoint can not be created or deleted manually.

Argument Reference

The following arguments are supported:

  • db_cluster_id - (Required, ForceNew) The Id of cluster that can run database.
  • endpoint_type - (Required & ForceNew before v1.121.0, Optional in v1.121.0+) Type of the endpoint. Before v1.121.0, it only can be Custom. since v1.121.0, Custom, Cluster, Primary are valid, default to Custom. However when creating a new endpoint, it also only can be Custom.
  • read_write_mode - (Optional) Read or write mode. Valid values are ReadWrite, ReadOnly. When creating a new custom endpoint, default to ReadOnly.
  • nodes - (Optional) Node id list for endpoint configuration. At least 2 nodes if specified, or if the cluster has more than 3 nodes, read-only endpoint is allowed to mount only one node. Default is all nodes.
  • auto_add_new_nodes - (Optional) Whether the new node automatically joins the default cluster address. Valid values are Enable, Disable. When creating a new custom endpoint, default to Disable.
  • endpoint_config - (Optional) The advanced settings of the endpoint of Apsara PolarDB clusters are in JSON format. Including the settings of consistency level, transaction splitting, connection pool, and offload reads from primary node. For more details, see the description of EndpointConfig in the Request parameters table for details.
  • ssl_enabled - (Optional, Available in v1.121.0+) Specifies how to modify the SSL encryption status. Valid values: Disable, Enable, Update.
  • net_type - (Optional, Available in v1.121.0+) The network type of the endpoint address.
  • ssl_auto_rotate - (Available in v1.132.0+) Specifies whether automatic rotation of SSL certificates is enabled. Valid values: Enable,Disable.
  • ssl_certificate_url - (Available in v1.132.0+) Specifies SSL certificate download link.
    NOTE: For a PolarDB for MySQL cluster, this parameter is required, and only one connection string in each endpoint can enable the ssl, for other notes, see Configure SSL encryption.
    For a PolarDB for PostgreSQL cluster or a PolarDB-O cluster, this parameter is not required, by default, SSL encryption is enabled for all endpoints.

Example Usage

using Pulumi;
using AliCloud = Pulumi.AliCloud;

class MyStack : Stack
{
    public MyStack()
    {
        var config = new Config();
        var creation = config.Get("creation") ?? "PolarDB";
        var name = config.Get("name") ?? "polardbconnectionbasic";
        var defaultZones = Output.Create(AliCloud.GetZones.InvokeAsync(new AliCloud.GetZonesArgs
        {
            AvailableResourceCreation = creation,
        }));
        var defaultNetwork = new AliCloud.Vpc.Network("defaultNetwork", new AliCloud.Vpc.NetworkArgs
        {
            CidrBlock = "172.16.0.0/16",
        });
        var defaultSwitch = new AliCloud.Vpc.Switch("defaultSwitch", new AliCloud.Vpc.SwitchArgs
        {
            VpcId = defaultNetwork.Id,
            CidrBlock = "172.16.0.0/24",
            ZoneId = defaultZones.Apply(defaultZones => defaultZones.Zones?[0]?.Id),
        });
        var defaultCluster = new AliCloud.PolarDB.Cluster("defaultCluster", new AliCloud.PolarDB.ClusterArgs
        {
            DbType = "MySQL",
            DbVersion = "8.0",
            PayType = "PostPaid",
            DbNodeClass = "polar.mysql.x4.large",
            VswitchId = defaultSwitch.Id,
            Description = name,
        });
        var endpoint = new AliCloud.PolarDB.Endpoint("endpoint", new AliCloud.PolarDB.EndpointArgs
        {
            DbClusterId = defaultCluster.Id,
            EndpointType = "Custom",
        });
    }

}
package main

import (
	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud"
	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/polardb"
	"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, "")
		creation := "PolarDB"
		if param := cfg.Get("creation"); param != "" {
			creation = param
		}
		name := "polardbconnectionbasic"
		if param := cfg.Get("name"); param != "" {
			name = param
		}
		defaultZones, err := alicloud.GetZones(ctx, &GetZonesArgs{
			AvailableResourceCreation: pulumi.StringRef(creation),
		}, nil)
		if err != nil {
			return err
		}
		defaultNetwork, err := vpc.NewNetwork(ctx, "defaultNetwork", &vpc.NetworkArgs{
			CidrBlock: pulumi.String("172.16.0.0/16"),
		})
		if err != nil {
			return err
		}
		defaultSwitch, err := vpc.NewSwitch(ctx, "defaultSwitch", &vpc.SwitchArgs{
			VpcId:     defaultNetwork.ID(),
			CidrBlock: pulumi.String("172.16.0.0/24"),
			ZoneId:    pulumi.String(defaultZones.Zones[0].Id),
		})
		if err != nil {
			return err
		}
		defaultCluster, err := polardb.NewCluster(ctx, "defaultCluster", &polardb.ClusterArgs{
			DbType:      pulumi.String("MySQL"),
			DbVersion:   pulumi.String("8.0"),
			PayType:     pulumi.String("PostPaid"),
			DbNodeClass: pulumi.String("polar.mysql.x4.large"),
			VswitchId:   defaultSwitch.ID(),
			Description: pulumi.String(name),
		})
		if err != nil {
			return err
		}
		_, err = polardb.NewEndpoint(ctx, "endpoint", &polardb.EndpointArgs{
			DbClusterId:  defaultCluster.ID(),
			EndpointType: pulumi.String("Custom"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}

Coming soon!

import pulumi
import pulumi_alicloud as alicloud

config = pulumi.Config()
creation = config.get("creation")
if creation is None:
    creation = "PolarDB"
name = config.get("name")
if name is None:
    name = "polardbconnectionbasic"
default_zones = alicloud.get_zones(available_resource_creation=creation)
default_network = alicloud.vpc.Network("defaultNetwork", cidr_block="172.16.0.0/16")
default_switch = alicloud.vpc.Switch("defaultSwitch",
    vpc_id=default_network.id,
    cidr_block="172.16.0.0/24",
    zone_id=default_zones.zones[0].id)
default_cluster = alicloud.polardb.Cluster("defaultCluster",
    db_type="MySQL",
    db_version="8.0",
    pay_type="PostPaid",
    db_node_class="polar.mysql.x4.large",
    vswitch_id=default_switch.id,
    description=name)
endpoint = alicloud.polardb.Endpoint("endpoint",
    db_cluster_id=default_cluster.id,
    endpoint_type="Custom")
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";

const config = new pulumi.Config();
const creation = config.get("creation") || "PolarDB";
const name = config.get("name") || "polardbconnectionbasic";
const defaultZones = alicloud.getZones({
    availableResourceCreation: creation,
});
const defaultNetwork = new alicloud.vpc.Network("defaultNetwork", {cidrBlock: "172.16.0.0/16"});
const defaultSwitch = new alicloud.vpc.Switch("defaultSwitch", {
    vpcId: defaultNetwork.id,
    cidrBlock: "172.16.0.0/24",
    zoneId: defaultZones.then(defaultZones => defaultZones.zones?[0]?.id),
});
const defaultCluster = new alicloud.polardb.Cluster("defaultCluster", {
    dbType: "MySQL",
    dbVersion: "8.0",
    payType: "PostPaid",
    dbNodeClass: "polar.mysql.x4.large",
    vswitchId: defaultSwitch.id,
    description: name,
});
const endpoint = new alicloud.polardb.Endpoint("endpoint", {
    dbClusterId: defaultCluster.id,
    endpointType: "Custom",
});

Coming soon!

Create a Endpoint Resource

new Endpoint(name: string, args: EndpointArgs, opts?: CustomResourceOptions);
@overload
def Endpoint(resource_name: str,
             opts: Optional[ResourceOptions] = None,
             auto_add_new_nodes: Optional[str] = None,
             db_cluster_id: Optional[str] = None,
             endpoint_config: Optional[Mapping[str, Any]] = None,
             endpoint_type: Optional[str] = None,
             net_type: Optional[str] = None,
             nodes: Optional[Sequence[str]] = None,
             read_write_mode: Optional[str] = None,
             ssl_auto_rotate: Optional[str] = None,
             ssl_enabled: Optional[str] = None)
@overload
def Endpoint(resource_name: str,
             args: EndpointArgs,
             opts: Optional[ResourceOptions] = None)
func NewEndpoint(ctx *Context, name string, args EndpointArgs, opts ...ResourceOption) (*Endpoint, error)
public Endpoint(string name, EndpointArgs args, CustomResourceOptions? opts = null)
public Endpoint(String name, EndpointArgs args)
public Endpoint(String name, EndpointArgs args, CustomResourceOptions options)
type: alicloud:polardb:Endpoint
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args EndpointArgs
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 EndpointArgs
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 EndpointArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args EndpointArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args EndpointArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

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

DbClusterId string
AutoAddNewNodes string
EndpointConfig Dictionary<string, object>
EndpointType string

Type of endpoint.

NetType string
Nodes List<string>
ReadWriteMode string
SslAutoRotate string
SslEnabled string
DbClusterId string
AutoAddNewNodes string
EndpointConfig map[string]interface{}
EndpointType string

Type of endpoint.

NetType string
Nodes []string
ReadWriteMode string
SslAutoRotate string
SslEnabled string
dbClusterId String
autoAddNewNodes String
endpointConfig Map<String,Object>
endpointType String

Type of endpoint.

netType String
nodes List<String>
readWriteMode String
sslAutoRotate String
sslEnabled String
dbClusterId string
autoAddNewNodes string
endpointConfig {[key: string]: any}
endpointType string

Type of endpoint.

netType string
nodes string[]
readWriteMode string
sslAutoRotate string
sslEnabled string
db_cluster_id str
auto_add_new_nodes str
endpoint_config Mapping[str, Any]
endpoint_type str

Type of endpoint.

net_type str
nodes Sequence[str]
read_write_mode str
ssl_auto_rotate str
ssl_enabled str
dbClusterId String
autoAddNewNodes String
endpointConfig Map<Any>
endpointType String

Type of endpoint.

netType String
nodes List<String>
readWriteMode String
sslAutoRotate String
sslEnabled String

Outputs

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

Id string

The provider-assigned unique ID for this managed resource.

SslCertificateUrl string
SslConnectionString string

(Available in v1.121.0+) The SSL connection string.

SslExpireTime string

(Available in v1.121.0+) The time when the SSL certificate expires. The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.

Id string

The provider-assigned unique ID for this managed resource.

SslCertificateUrl string
SslConnectionString string

(Available in v1.121.0+) The SSL connection string.

SslExpireTime string

(Available in v1.121.0+) The time when the SSL certificate expires. The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.

id String

The provider-assigned unique ID for this managed resource.

sslCertificateUrl String
sslConnectionString String

(Available in v1.121.0+) The SSL connection string.

sslExpireTime String

(Available in v1.121.0+) The time when the SSL certificate expires. The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.

id string

The provider-assigned unique ID for this managed resource.

sslCertificateUrl string
sslConnectionString string

(Available in v1.121.0+) The SSL connection string.

sslExpireTime string

(Available in v1.121.0+) The time when the SSL certificate expires. The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.

id str

The provider-assigned unique ID for this managed resource.

ssl_certificate_url str
ssl_connection_string str

(Available in v1.121.0+) The SSL connection string.

ssl_expire_time str

(Available in v1.121.0+) The time when the SSL certificate expires. The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.

id String

The provider-assigned unique ID for this managed resource.

sslCertificateUrl String
sslConnectionString String

(Available in v1.121.0+) The SSL connection string.

sslExpireTime String

(Available in v1.121.0+) The time when the SSL certificate expires. The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.

Look up an Existing Endpoint Resource

Get an existing Endpoint 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?: EndpointState, opts?: CustomResourceOptions): Endpoint
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        auto_add_new_nodes: Optional[str] = None,
        db_cluster_id: Optional[str] = None,
        endpoint_config: Optional[Mapping[str, Any]] = None,
        endpoint_type: Optional[str] = None,
        net_type: Optional[str] = None,
        nodes: Optional[Sequence[str]] = None,
        read_write_mode: Optional[str] = None,
        ssl_auto_rotate: Optional[str] = None,
        ssl_certificate_url: Optional[str] = None,
        ssl_connection_string: Optional[str] = None,
        ssl_enabled: Optional[str] = None,
        ssl_expire_time: Optional[str] = None) -> Endpoint
func GetEndpoint(ctx *Context, name string, id IDInput, state *EndpointState, opts ...ResourceOption) (*Endpoint, error)
public static Endpoint Get(string name, Input<string> id, EndpointState? state, CustomResourceOptions? opts = null)
public static Endpoint get(String name, Output<String> id, EndpointState 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:
AutoAddNewNodes string
DbClusterId string
EndpointConfig Dictionary<string, object>
EndpointType string

Type of endpoint.

NetType string
Nodes List<string>
ReadWriteMode string
SslAutoRotate string
SslCertificateUrl string
SslConnectionString string

(Available in v1.121.0+) The SSL connection string.

SslEnabled string
SslExpireTime string

(Available in v1.121.0+) The time when the SSL certificate expires. The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.

AutoAddNewNodes string
DbClusterId string
EndpointConfig map[string]interface{}
EndpointType string

Type of endpoint.

NetType string
Nodes []string
ReadWriteMode string
SslAutoRotate string
SslCertificateUrl string
SslConnectionString string

(Available in v1.121.0+) The SSL connection string.

SslEnabled string
SslExpireTime string

(Available in v1.121.0+) The time when the SSL certificate expires. The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.

autoAddNewNodes String
dbClusterId String
endpointConfig Map<String,Object>
endpointType String

Type of endpoint.

netType String
nodes List<String>
readWriteMode String
sslAutoRotate String
sslCertificateUrl String
sslConnectionString String

(Available in v1.121.0+) The SSL connection string.

sslEnabled String
sslExpireTime String

(Available in v1.121.0+) The time when the SSL certificate expires. The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.

autoAddNewNodes string
dbClusterId string
endpointConfig {[key: string]: any}
endpointType string

Type of endpoint.

netType string
nodes string[]
readWriteMode string
sslAutoRotate string
sslCertificateUrl string
sslConnectionString string

(Available in v1.121.0+) The SSL connection string.

sslEnabled string
sslExpireTime string

(Available in v1.121.0+) The time when the SSL certificate expires. The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.

auto_add_new_nodes str
db_cluster_id str
endpoint_config Mapping[str, Any]
endpoint_type str

Type of endpoint.

net_type str
nodes Sequence[str]
read_write_mode str
ssl_auto_rotate str
ssl_certificate_url str
ssl_connection_string str

(Available in v1.121.0+) The SSL connection string.

ssl_enabled str
ssl_expire_time str

(Available in v1.121.0+) The time when the SSL certificate expires. The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.

autoAddNewNodes String
dbClusterId String
endpointConfig Map<Any>
endpointType String

Type of endpoint.

netType String
nodes List<String>
readWriteMode String
sslAutoRotate String
sslCertificateUrl String
sslConnectionString String

(Available in v1.121.0+) The SSL connection string.

sslEnabled String
sslExpireTime String

(Available in v1.121.0+) The time when the SSL certificate expires. The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.

Import

PolarDB endpoint can be imported using the id, e.g.

 $ pulumi import alicloud:polardb/endpoint:Endpoint example pc-abc123456:pe-abc123456

Package Details

Repository
https://github.com/pulumi/pulumi-alicloud
License
Apache-2.0
Notes

This Pulumi package is based on the alicloud Terraform Provider.