alicloud logo
Alibaba Cloud v3.34.0, Mar 17 23

alicloud.gpdb.Connection

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

NOTE: Available in 1.48.0+

NOTE: Each instance will allocate a intranet connection string automatically and its prefix is instance ID. To avoid unnecessary conflict, please specified a internet connection prefix before applying the resource.

Example Usage

Coming soon!

Coming soon!

package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.AlicloudFunctions;
import com.pulumi.alicloud.inputs.GetZonesArgs;
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.gpdb.Instance;
import com.pulumi.alicloud.gpdb.InstanceArgs;
import com.pulumi.alicloud.gpdb.Connection;
import com.pulumi.alicloud.gpdb.ConnectionArgs;
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 config = ctx.config();
        final var creation = config.get("creation").orElse("Gpdb");
        final var name = config.get("name").orElse("gpdbConnectionBasic");
        final var defaultZones = AlicloudFunctions.getZones(GetZonesArgs.builder()
            .availableResourceCreation(creation)
            .build());

        var defaultNetwork = new Network("defaultNetwork", NetworkArgs.builder()        
            .cidrBlock("172.16.0.0/16")
            .build());

        var defaultSwitch = new Switch("defaultSwitch", SwitchArgs.builder()        
            .vpcId(defaultNetwork.id())
            .cidrBlock("172.16.0.0/24")
            .zoneId(defaultZones.applyValue(getZonesResult -> getZonesResult.zones()[0].id()))
            .build());

        var defaultInstance = new Instance("defaultInstance", InstanceArgs.builder()        
            .vswitchId(defaultSwitch.id())
            .engine("gpdb")
            .engineVersion("4.3")
            .instanceClass("gpdb.group.segsdx2")
            .instanceGroupCount("2")
            .description(name)
            .build());

        var defaultConnection = new Connection("defaultConnection", ConnectionArgs.builder()        
            .instanceId(defaultInstance.id())
            .connectionPrefix("testAbc")
            .build());

    }
}

Coming soon!

Coming soon!

configuration:
  creation:
    type: string
    default: Gpdb
  name:
    type: string
    default: gpdbConnectionBasic
resources:
  defaultNetwork:
    type: alicloud:vpc:Network
    properties:
      cidrBlock: 172.16.0.0/16
  defaultSwitch:
    type: alicloud:vpc:Switch
    properties:
      vpcId: ${defaultNetwork.id}
      cidrBlock: 172.16.0.0/24
      zoneId: ${defaultZones.zones[0].id}
  defaultInstance:
    type: alicloud:gpdb:Instance
    properties:
      vswitchId: ${defaultSwitch.id}
      engine: gpdb
      engineVersion: '4.3'
      instanceClass: gpdb.group.segsdx2
      instanceGroupCount: '2'
      description: ${name}
  defaultConnection:
    type: alicloud:gpdb:Connection
    properties:
      instanceId: ${defaultInstance.id}
      connectionPrefix: testAbc
variables:
  defaultZones:
    fn::invoke:
      Function: alicloud:getZones
      Arguments:
        availableResourceCreation: ${creation}

Create Connection Resource

new Connection(name: string, args: ConnectionArgs, opts?: CustomResourceOptions);
@overload
def Connection(resource_name: str,
               opts: Optional[ResourceOptions] = None,
               connection_prefix: Optional[str] = None,
               instance_id: Optional[str] = None,
               port: Optional[str] = None)
@overload
def Connection(resource_name: str,
               args: ConnectionArgs,
               opts: Optional[ResourceOptions] = None)
func NewConnection(ctx *Context, name string, args ConnectionArgs, opts ...ResourceOption) (*Connection, error)
public Connection(string name, ConnectionArgs args, CustomResourceOptions? opts = null)
public Connection(String name, ConnectionArgs args)
public Connection(String name, ConnectionArgs args, CustomResourceOptions options)
type: alicloud:gpdb:Connection
properties: # The arguments to resource properties.
options: # 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.
resource_name str
The unique name of the resource.
args ConnectionArgs
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 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.
name String
The unique name of the resource.
args ConnectionArgs
The arguments to resource properties.
options 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 Architecture and Concepts 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 <instance_id> + '-tf'.

Port string

Internet connection port. Valid value: [3200-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 <instance_id> + '-tf'.

Port string

Internet connection port. Valid value: [3200-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 <instance_id> + '-tf'.

port String

Internet connection port. Valid value: [3200-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 <instance_id> + '-tf'.

port string

Internet connection port. Valid value: [3200-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 <instance_id> + '-tf'.

port str

Internet connection port. Valid value: [3200-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 <instance_id> + '-tf'.

port String

Internet connection port. Valid value: [3200-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.

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.

connectionString String

Connection instance string.

id String

The provider-assigned unique ID for this managed resource.

ipAddress String

The ip address of connection string.

Look up 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
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        connection_prefix: Optional[str] = None,
        connection_string: Optional[str] = None,
        instance_id: Optional[str] = None,
        ip_address: Optional[str] = None,
        port: Optional[str] = None) -> Connection
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)
public static Connection get(String name, Output<String> id, ConnectionState 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:
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 <instance_id> + '-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: [3200-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 <instance_id> + '-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: [3200-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 <instance_id> + '-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: [3200-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 <instance_id> + '-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: [3200-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 <instance_id> + '-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: [3200-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 <instance_id> + '-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: [3200-3999]. Default to 3306.

Import

AnalyticDB for PostgreSQL’s connection can be imported using the id, e.g.

 $ pulumi import alicloud:gpdb/connection:Connection example abc12345678

Package Details

Repository
Alibaba Cloud pulumi/pulumi-alicloud
License
Apache-2.0
Notes

This Pulumi package is based on the alicloud Terraform Provider.