Connection
Provides an ADB connection resource to allocate an Internet connection string for ADB cluster.
NOTE: Each ADB instance will allocate a intranet connnection string automatically and its prifix is ADB instance ID. To avoid unnecessary conflict, please specified a internet connection prefix before applying the resource.
NOTE: Available in v1.81.0+.
Example Usage
using Pulumi;
using AliCloud = Pulumi.AliCloud;
class MyStack : Stack
{
public MyStack()
{
var config = new Config();
var creation = config.Get("creation") ?? "ADB";
var name = config.Get("name") ?? "adbaccountmysql";
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
{
AvailabilityZone = defaultZones.Apply(defaultZones => defaultZones.Zones[0].Id),
CidrBlock = "172.16.0.0/24",
VpcId = defaultNetwork.Id,
});
var cluster = new AliCloud.Adb.Cluster("cluster", new AliCloud.Adb.ClusterArgs
{
DbClusterCategory = "Cluster",
DbClusterVersion = "3.0",
DbNodeClass = "C8",
DbNodeCount = 2,
DbNodeStorage = 200,
Description = name,
PayType = "PostPaid",
VswitchId = defaultSwitch.Id,
});
var connection = new AliCloud.Adb.Connection("connection", new AliCloud.Adb.ConnectionArgs
{
ConnectionPrefix = "testabc",
DbClusterId = cluster.Id,
});
}
}
Coming soon!
import pulumi
import pulumi_alicloud as alicloud
config = pulumi.Config()
creation = config.get("creation")
if creation is None:
creation = "ADB"
name = config.get("name")
if name is None:
name = "adbaccountmysql"
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",
availability_zone=default_zones.zones[0]["id"],
cidr_block="172.16.0.0/24",
vpc_id=default_network.id)
cluster = alicloud.adb.Cluster("cluster",
db_cluster_category="Cluster",
db_cluster_version="3.0",
db_node_class="C8",
db_node_count=2,
db_node_storage=200,
description=name,
pay_type="PostPaid",
vswitch_id=default_switch.id)
connection = alicloud.adb.Connection("connection",
connection_prefix="testabc",
db_cluster_id=cluster.id)import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
const config = new pulumi.Config();
const creation = config.get("creation") || "ADB";
const name = config.get("name") || "adbaccountmysql";
const defaultZones = pulumi.output(alicloud.getZones({
availableResourceCreation: creation,
}, { async: true }));
const defaultNetwork = new alicloud.vpc.Network("default", {
cidrBlock: "172.16.0.0/16",
});
const defaultSwitch = new alicloud.vpc.Switch("default", {
availabilityZone: defaultZones.zones[0].id,
cidrBlock: "172.16.0.0/24",
vpcId: defaultNetwork.id,
});
const cluster = new alicloud.adb.Cluster("cluster", {
dbClusterCategory: "Cluster",
dbClusterVersion: "3.0",
dbNodeClass: "C8",
dbNodeCount: 2,
dbNodeStorage: 200,
description: name,
payType: "PostPaid",
vswitchId: defaultSwitch.id,
});
const connection = new alicloud.adb.Connection("connection", {
connectionPrefix: "testabc",
dbClusterId: cluster.id,
});Create a Connection Resource
new Connection(name: string, args: ConnectionArgs, opts?: CustomResourceOptions);def Connection(resource_name, opts=None, connection_prefix=None, db_cluster_id=None, __props__=None);func NewConnection(ctx *Context, name string, args ConnectionArgs, opts ...ResourceOption) (*Connection, error)public Connection(string name, ConnectionArgs args, CustomResourceOptions? opts = null)- name string
- The unique name of the resource.
- args ConnectionArgs
- 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 ConnectionArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args ConnectionArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
Connection Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.
Inputs
The Connection resource accepts the following input properties:
- Db
Cluster stringId The Id of cluster 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’.
- Db
Cluster stringId The Id of cluster 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’.
- db
Cluster stringId The Id of cluster 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’.
- db_
cluster_ strid The Id of cluster 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’.
Outputs
All input properties are implicitly available as output properties. Additionally, the Connection resource produces the following output properties:
- connection_
string str Connection cluster 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 port.
Look up an Existing Connection Resource
Get an existing Connection 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?: ConnectionState, opts?: CustomResourceOptions): Connectionstatic get(resource_name, id, opts=None, connection_prefix=None, connection_string=None, db_cluster_id=None, ip_address=None, port=None, __props__=None);func GetConnection(ctx *Context, name string, id IDInput, state *ConnectionState, opts ...ResourceOption) (*Connection, error)public static Connection Get(string name, Input<string> id, ConnectionState? 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 string.
- Db
Cluster stringId The Id of cluster that can run database.
- Ip
Address string The ip address of connection string.
- Port string
Connection cluster 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 string.
- Db
Cluster stringId The Id of cluster that can run database.
- Ip
Address string The ip address of connection string.
- Port string
Connection cluster 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 string.
- db
Cluster stringId The Id of cluster that can run database.
- ip
Address string The ip address of connection string.
- port string
Connection cluster 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 string.
- db_
cluster_ strid The Id of cluster that can run database.
- ip_
address str The ip address of connection string.
- port str
Connection cluster port.
Package Details
- Repository
- https://github.com/pulumi/pulumi-alicloud
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
alicloudTerraform Provider.