Connection

Provides an RDS connection resource to allocate an Internet connection string for RDS instance.

NOTE: Each RDS instance will allocate a intranet connnection string automatically and its prifix is RDS instance 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") ?? "Rds";
        var name = config.Get("name") ?? "dbconnectionbasic";
        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 instance = new AliCloud.Rds.Instance("instance", new AliCloud.Rds.InstanceArgs
        {
            Engine = "MySQL",
            EngineVersion = "5.6",
            InstanceName = name,
            InstanceStorage = 10,
            InstanceType = "rds.mysql.t1.small",
            VswitchId = defaultSwitch.Id,
        });
        var foo = new AliCloud.Rds.Connection("foo", new AliCloud.Rds.ConnectionArgs
        {
            ConnectionPrefix = "testabc",
            InstanceId = instance.Id,
        });
    }

}

Coming soon!

import pulumi
import pulumi_alicloud as alicloud

config = pulumi.Config()
creation = config.get("creation")
if creation is None:
    creation = "Rds"
name = config.get("name")
if name is None:
    name = "dbconnectionbasic"
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)
instance = alicloud.rds.Instance("instance",
    engine="MySQL",
    engine_version="5.6",
    instance_name=name,
    instance_storage="10",
    instance_type="rds.mysql.t1.small",
    vswitch_id=default_switch.id)
foo = alicloud.rds.Connection("foo",
    connection_prefix="testabc",
    instance_id=instance.id)
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";

const config = new pulumi.Config();
const creation = config.get("creation") || "Rds";
const name = config.get("name") || "dbconnectionbasic";

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 instance = new alicloud.rds.Instance("instance", {
    engine: "MySQL",
    engineVersion: "5.6",
    instanceName: name,
    instanceStorage: 10,
    instanceType: "rds.mysql.t1.small",
    vswitchId: defaultSwitch.id,
});
const foo = new alicloud.rds.Connection("foo", {
    connectionPrefix: "testabc",
    instanceId: instance.id,
});

Create a Connection Resource

def Connection(resource_name, opts=None, connection_prefix=None, instance_id=None, port=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:

InstanceId string

The Id of instance that can run database.

ConnectionPrefix 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’.

Port string

Internet connection port. Valid value: [3001-3999]. Default to 3306.

InstanceId string

The Id of instance that can run database.

ConnectionPrefix 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’.

Port string

Internet connection port. Valid value: [3001-3999]. Default to 3306.

instanceId string

The Id of instance that can run database.

connectionPrefix 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’.

port string

Internet connection port. Valid value: [3001-3999]. Default to 3306.

instance_id str

The Id of instance 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’.

port str

Internet connection port. Valid value: [3001-3999]. Default to 3306.

Outputs

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

ConnectionString string

Connection instance string.

Id string
The provider-assigned unique ID for this managed resource.
IpAddress string

The ip address of connection string.

ConnectionString string

Connection instance string.

Id string
The provider-assigned unique ID for this managed resource.
IpAddress string

The ip address of connection string.

connectionString string

Connection instance string.

id string
The provider-assigned unique ID for this managed resource.
ipAddress string

The ip address of connection string.

connection_string str

Connection instance string.

id str
The provider-assigned unique ID for this managed resource.
ip_address str

The ip address of connection string.

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): Connection
static get(resource_name, id, opts=None, connection_prefix=None, connection_string=None, instance_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:

ConnectionPrefix 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’.

ConnectionString string

Connection instance string.

InstanceId string

The Id of instance that can run database.

IpAddress string

The ip address of connection string.

Port string

Internet connection port. Valid value: [3001-3999]. Default to 3306.

ConnectionPrefix 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’.

ConnectionString string

Connection instance string.

InstanceId string

The Id of instance that can run database.

IpAddress string

The ip address of connection string.

Port string

Internet connection port. Valid value: [3001-3999]. Default to 3306.

connectionPrefix 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’.

connectionString string

Connection instance string.

instanceId string

The Id of instance that can run database.

ipAddress string

The ip address of connection string.

port string

Internet connection port. Valid value: [3001-3999]. Default to 3306.

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 instance string.

instance_id str

The Id of instance that can run database.

ip_address str

The ip address of connection string.

port str

Internet connection port. Valid value: [3001-3999]. Default to 3306.

Package Details

Repository
https://github.com/pulumi/pulumi-alicloud
License
Apache-2.0
Notes
This Pulumi package is based on the alicloud Terraform Provider.