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.
Example Usage
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.polardb.PolardbFunctions;
import com.pulumi.alicloud.polardb.inputs.GetNodeClassesArgs;
import com.pulumi.alicloud.vpc.Network;
import com.pulumi.alicloud.vpc.NetworkArgs;
import com.pulumi.alicloud.vpc.Switch;
import com.pulumi.alicloud.vpc.SwitchArgs;
import com.pulumi.alicloud.polardb.Cluster;
import com.pulumi.alicloud.polardb.ClusterArgs;
import com.pulumi.alicloud.polardb.Endpoint;
import com.pulumi.alicloud.polardb.EndpointArgs;
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 defaultNodeClasses = PolardbFunctions.getNodeClasses(GetNodeClassesArgs.builder()
.dbType("MySQL")
.dbVersion("8.0")
.payType("PostPaid")
.build());
var defaultNetwork = new Network("defaultNetwork", NetworkArgs.builder()
.vpcName("terraform-example")
.cidrBlock("172.16.0.0/16")
.build());
var defaultSwitch = new Switch("defaultSwitch", SwitchArgs.builder()
.vpcId(defaultNetwork.id())
.cidrBlock("172.16.0.0/24")
.zoneId(defaultNodeClasses.applyValue(getNodeClassesResult -> getNodeClassesResult.classes()[0].zoneId()))
.vswitchName("terraform-example")
.build());
var defaultCluster = new Cluster("defaultCluster", ClusterArgs.builder()
.dbType("MySQL")
.dbVersion("8.0")
.dbNodeClass(defaultNodeClasses.applyValue(getNodeClassesResult -> getNodeClassesResult.classes()[0].supportedEngines()[0].availableResources()[0].dbNodeClass()))
.payType("PostPaid")
.vswitchId(defaultSwitch.id())
.description("terraform-example")
.build());
var defaultEndpoint = new Endpoint("defaultEndpoint", EndpointArgs.builder()
.dbClusterId(defaultCluster.id())
.endpointType("Custom")
.build());
}
}
Argument Reference
The following arguments are supported:
db_cluster_id
- (Required, ForceNew) The Id of cluster that can run database.endpoint_type
- (Optional, ForceNew) Type of the endpoint. Before v1.121.0, it only can beCustom
. since v1.121.0,Custom
,Cluster
,Primary
are valid, default toCustom
. However when creating a new endpoint, it also only can beCustom
.read_write_mode
- (Optional) Read or write mode. Valid values areReadWrite
,ReadOnly
. When creating a new custom endpoint, default toReadOnly
.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 areEnable
,Disable
. When creating a new custom endpoint, default toDisable
.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.db_endpoint_description
- (Optional, Available in v1.201.0+) The name of the endpoint.
Import
PolarDB endpoint can be imported using the id, e.g.
$ pulumi import alicloud:polardb/endpoint:Endpoint example pc-abc123456:pe-abc123456