EndpointAddress
Provides a PolarDB endpoint address resource to allocate an Internet endpoint address string for PolarDB instance.
NOTE: Available in v1.68.0+. Each PolarDB instance will allocate a intranet connection string automatically and its prefix is Cluster ID. To avoid unnecessary conflict, please specified a internet connection prefix before applying the resource.
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",
AvailabilityZone = 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 defaultEndpoints = defaultCluster.Id.Apply(id => AliCloud.PolarDB.GetEndpoints.InvokeAsync(new AliCloud.PolarDB.GetEndpointsArgs
{
DbClusterId = id,
}));
var endpoint = new AliCloud.PolarDB.EndpointAddress("endpoint", new AliCloud.PolarDB.EndpointAddressArgs
{
DbClusterId = defaultCluster.Id,
DbEndpointId = defaultEndpoints.Apply(defaultEndpoints => defaultEndpoints.Endpoints[0].DbEndpointId),
ConnectionPrefix = "testpolardbconn",
NetType = "Public",
});
}
}
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",
availability_zone=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)
default_endpoints = default_cluster.id.apply(lambda id: alicloud.polardb.get_endpoints(db_cluster_id=id))
endpoint = alicloud.polardb.EndpointAddress("endpoint",
db_cluster_id=default_cluster.id,
db_endpoint_id=default_endpoints.endpoints[0]["db_endpoint_id"],
connection_prefix="testpolardbconn",
net_type="Public")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",
availabilityZone: 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 defaultEndpoints = defaultCluster.id.apply(id => alicloud.polardb.getEndpoints({
dbClusterId: id,
}));
const endpoint = new alicloud.polardb.EndpointAddress("endpoint", {
dbClusterId: defaultCluster.id,
dbEndpointId: defaultEndpoints.endpoints[0].dbEndpointId,
connectionPrefix: "testpolardbconn",
netType: "Public",
});Create a EndpointAddress Resource
new EndpointAddress(name: string, args: EndpointAddressArgs, opts?: CustomResourceOptions);def EndpointAddress(resource_name, opts=None, connection_prefix=None, db_cluster_id=None, db_endpoint_id=None, net_type=None, __props__=None);func NewEndpointAddress(ctx *Context, name string, args EndpointAddressArgs, opts ...ResourceOption) (*EndpointAddress, error)public EndpointAddress(string name, EndpointAddressArgs args, CustomResourceOptions? opts = null)- name string
- The unique name of the resource.
- args EndpointAddressArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- opts ResourceOptions
- A bag of options that control this resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args EndpointAddressArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args EndpointAddressArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
EndpointAddress Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.
Inputs
The EndpointAddress resource accepts the following input properties:
- Db
Cluster stringId The Id of cluster that can run database.
- Db
Endpoint stringId The Id of endpoint that can run database.
- Connection
Prefix string Prefix of an Internet connection string. It must be checked for uniqueness. It may consist of lowercase letters, numbers, and underlines, and must start with a letter and have no more than 30 characters. Default to
+ ‘tf’. - Net
Type string Internet connection net type. Valid value:
Public. Default toPublic. Currently supported onlyPublic.
- Db
Cluster stringId The Id of cluster that can run database.
- Db
Endpoint stringId The Id of endpoint that can run database.
- Connection
Prefix string Prefix of an Internet connection string. It must be checked for uniqueness. It may consist of lowercase letters, numbers, and underlines, and must start with a letter and have no more than 30 characters. Default to
+ ‘tf’. - Net
Type string Internet connection net type. Valid value:
Public. Default toPublic. Currently supported onlyPublic.
- db
Cluster stringId The Id of cluster that can run database.
- db
Endpoint stringId The Id of endpoint that can run database.
- connection
Prefix string Prefix of an Internet connection string. It must be checked for uniqueness. It may consist of lowercase letters, numbers, and underlines, and must start with a letter and have no more than 30 characters. Default to
+ ‘tf’. - net
Type string Internet connection net type. Valid value:
Public. Default toPublic. Currently supported onlyPublic.
- db_
cluster_ strid The Id of cluster that can run database.
- db_
endpoint_ strid The Id of endpoint that can run database.
- connection_
prefix str Prefix of an Internet connection string. It must be checked for uniqueness. It may consist of lowercase letters, numbers, and underlines, and must start with a letter and have no more than 30 characters. Default to
+ ‘tf’. - net_
type str Internet connection net type. Valid value:
Public. Default toPublic. Currently supported onlyPublic.
Outputs
All input properties are implicitly available as output properties. Additionally, the EndpointAddress resource produces the following output properties:
- connection_
string str Connection cluster or endpoint string.
- id str
- The provider-assigned unique ID for this managed resource.
- ip_
address str The ip address of connection string.
- port str
Connection cluster or endpoint port.
Look up an Existing EndpointAddress Resource
Get an existing EndpointAddress 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?: EndpointAddressState, opts?: CustomResourceOptions): EndpointAddressstatic get(resource_name, id, opts=None, connection_prefix=None, connection_string=None, db_cluster_id=None, db_endpoint_id=None, ip_address=None, net_type=None, port=None, __props__=None);func GetEndpointAddress(ctx *Context, name string, id IDInput, state *EndpointAddressState, opts ...ResourceOption) (*EndpointAddress, error)public static EndpointAddress Get(string name, Input<string> id, EndpointAddressState? state, CustomResourceOptions? opts = null)- 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.
The following state arguments are supported:
- Connection
Prefix string Prefix of an Internet connection string. It must be checked for uniqueness. It may consist of lowercase letters, numbers, and underlines, and must start with a letter and have no more than 30 characters. Default to
+ ‘tf’. - Connection
String string Connection cluster or endpoint string.
- Db
Cluster stringId The Id of cluster that can run database.
- Db
Endpoint stringId The Id of endpoint that can run database.
- Ip
Address string The ip address of connection string.
- Net
Type string Internet connection net type. Valid value:
Public. Default toPublic. Currently supported onlyPublic.- Port string
Connection cluster or endpoint port.
- Connection
Prefix string Prefix of an Internet connection string. It must be checked for uniqueness. It may consist of lowercase letters, numbers, and underlines, and must start with a letter and have no more than 30 characters. Default to
+ ‘tf’. - Connection
String string Connection cluster or endpoint string.
- Db
Cluster stringId The Id of cluster that can run database.
- Db
Endpoint stringId The Id of endpoint that can run database.
- Ip
Address string The ip address of connection string.
- Net
Type string Internet connection net type. Valid value:
Public. Default toPublic. Currently supported onlyPublic.- Port string
Connection cluster or endpoint port.
- connection
Prefix string Prefix of an Internet connection string. It must be checked for uniqueness. It may consist of lowercase letters, numbers, and underlines, and must start with a letter and have no more than 30 characters. Default to
+ ‘tf’. - connection
String string Connection cluster or endpoint string.
- db
Cluster stringId The Id of cluster that can run database.
- db
Endpoint stringId The Id of endpoint that can run database.
- ip
Address string The ip address of connection string.
- net
Type string Internet connection net type. Valid value:
Public. Default toPublic. Currently supported onlyPublic.- port string
Connection cluster or endpoint port.
- connection_
prefix str Prefix of an Internet connection string. It must be checked for uniqueness. It may consist of lowercase letters, numbers, and underlines, and must start with a letter and have no more than 30 characters. Default to
+ ‘tf’. - connection_
string str Connection cluster or endpoint string.
- db_
cluster_ strid The Id of cluster that can run database.
- db_
endpoint_ strid The Id of endpoint that can run database.
- ip_
address str The ip address of connection string.
- net_
type str Internet connection net type. Valid value:
Public. Default toPublic. Currently supported onlyPublic.- port str
Connection cluster or endpoint port.
Package Details
- Repository
- https://github.com/pulumi/pulumi-alicloud
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
alicloudTerraform Provider.