1. Packages
  2. Digitalocean Provider
  3. API Docs
  4. DatabaseConnectionPool
DigitalOcean v4.36.0 published on Wednesday, Dec 4, 2024 by Pulumi

digitalocean.DatabaseConnectionPool

Explore with Pulumi AI

digitalocean logo
DigitalOcean v4.36.0 published on Wednesday, Dec 4, 2024 by Pulumi

    Provides a DigitalOcean database connection pool resource.

    Example Usage

    Create a new PostgreSQL database connection pool

    import * as pulumi from "@pulumi/pulumi";
    import * as digitalocean from "@pulumi/digitalocean";
    
    const postgres_example = new digitalocean.DatabaseCluster("postgres-example", {
        name: "example-postgres-cluster",
        engine: "pg",
        version: "15",
        size: digitalocean.DatabaseSlug.DB_1VPCU1GB,
        region: digitalocean.Region.NYC1,
        nodeCount: 1,
    });
    const pool_01 = new digitalocean.DatabaseConnectionPool("pool-01", {
        clusterId: postgres_example.id,
        name: "pool-01",
        mode: "transaction",
        size: 20,
        dbName: "defaultdb",
        user: "doadmin",
    });
    
    import pulumi
    import pulumi_digitalocean as digitalocean
    
    postgres_example = digitalocean.DatabaseCluster("postgres-example",
        name="example-postgres-cluster",
        engine="pg",
        version="15",
        size=digitalocean.DatabaseSlug.D_B_1_VPCU1_GB,
        region=digitalocean.Region.NYC1,
        node_count=1)
    pool_01 = digitalocean.DatabaseConnectionPool("pool-01",
        cluster_id=postgres_example.id,
        name="pool-01",
        mode="transaction",
        size=20,
        db_name="defaultdb",
        user="doadmin")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-digitalocean/sdk/v4/go/digitalocean"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := digitalocean.NewDatabaseCluster(ctx, "postgres-example", &digitalocean.DatabaseClusterArgs{
    			Name:      pulumi.String("example-postgres-cluster"),
    			Engine:    pulumi.String("pg"),
    			Version:   pulumi.String("15"),
    			Size:      pulumi.String(digitalocean.DatabaseSlug_DB_1VPCU1GB),
    			Region:    pulumi.String(digitalocean.RegionNYC1),
    			NodeCount: pulumi.Int(1),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = digitalocean.NewDatabaseConnectionPool(ctx, "pool-01", &digitalocean.DatabaseConnectionPoolArgs{
    			ClusterId: postgres_example.ID(),
    			Name:      pulumi.String("pool-01"),
    			Mode:      pulumi.String("transaction"),
    			Size:      pulumi.Int(20),
    			DbName:    pulumi.String("defaultdb"),
    			User:      pulumi.String("doadmin"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using DigitalOcean = Pulumi.DigitalOcean;
    
    return await Deployment.RunAsync(() => 
    {
        var postgres_example = new DigitalOcean.DatabaseCluster("postgres-example", new()
        {
            Name = "example-postgres-cluster",
            Engine = "pg",
            Version = "15",
            Size = DigitalOcean.DatabaseSlug.DB_1VPCU1GB,
            Region = DigitalOcean.Region.NYC1,
            NodeCount = 1,
        });
    
        var pool_01 = new DigitalOcean.DatabaseConnectionPool("pool-01", new()
        {
            ClusterId = postgres_example.Id,
            Name = "pool-01",
            Mode = "transaction",
            Size = 20,
            DbName = "defaultdb",
            User = "doadmin",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.digitalocean.DatabaseCluster;
    import com.pulumi.digitalocean.DatabaseClusterArgs;
    import com.pulumi.digitalocean.DatabaseConnectionPool;
    import com.pulumi.digitalocean.DatabaseConnectionPoolArgs;
    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) {
            var postgres_example = new DatabaseCluster("postgres-example", DatabaseClusterArgs.builder()
                .name("example-postgres-cluster")
                .engine("pg")
                .version("15")
                .size("db-s-1vcpu-1gb")
                .region("nyc1")
                .nodeCount(1)
                .build());
    
            var pool_01 = new DatabaseConnectionPool("pool-01", DatabaseConnectionPoolArgs.builder()
                .clusterId(postgres_example.id())
                .name("pool-01")
                .mode("transaction")
                .size(20)
                .dbName("defaultdb")
                .user("doadmin")
                .build());
    
        }
    }
    
    resources:
      pool-01:
        type: digitalocean:DatabaseConnectionPool
        properties:
          clusterId: ${["postgres-example"].id}
          name: pool-01
          mode: transaction
          size: 20
          dbName: defaultdb
          user: doadmin
      postgres-example:
        type: digitalocean:DatabaseCluster
        properties:
          name: example-postgres-cluster
          engine: pg
          version: '15'
          size: db-s-1vcpu-1gb
          region: nyc1
          nodeCount: 1
    

    Create DatabaseConnectionPool Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new DatabaseConnectionPool(name: string, args: DatabaseConnectionPoolArgs, opts?: CustomResourceOptions);
    @overload
    def DatabaseConnectionPool(resource_name: str,
                               args: DatabaseConnectionPoolArgs,
                               opts: Optional[ResourceOptions] = None)
    
    @overload
    def DatabaseConnectionPool(resource_name: str,
                               opts: Optional[ResourceOptions] = None,
                               cluster_id: Optional[str] = None,
                               db_name: Optional[str] = None,
                               mode: Optional[str] = None,
                               size: Optional[int] = None,
                               name: Optional[str] = None,
                               user: Optional[str] = None)
    func NewDatabaseConnectionPool(ctx *Context, name string, args DatabaseConnectionPoolArgs, opts ...ResourceOption) (*DatabaseConnectionPool, error)
    public DatabaseConnectionPool(string name, DatabaseConnectionPoolArgs args, CustomResourceOptions? opts = null)
    public DatabaseConnectionPool(String name, DatabaseConnectionPoolArgs args)
    public DatabaseConnectionPool(String name, DatabaseConnectionPoolArgs args, CustomResourceOptions options)
    
    type: digitalocean:DatabaseConnectionPool
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args DatabaseConnectionPoolArgs
    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 DatabaseConnectionPoolArgs
    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 DatabaseConnectionPoolArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args DatabaseConnectionPoolArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args DatabaseConnectionPoolArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var databaseConnectionPoolResource = new DigitalOcean.DatabaseConnectionPool("databaseConnectionPoolResource", new()
    {
        ClusterId = "string",
        DbName = "string",
        Mode = "string",
        Size = 0,
        Name = "string",
        User = "string",
    });
    
    example, err := digitalocean.NewDatabaseConnectionPool(ctx, "databaseConnectionPoolResource", &digitalocean.DatabaseConnectionPoolArgs{
    	ClusterId: pulumi.String("string"),
    	DbName:    pulumi.String("string"),
    	Mode:      pulumi.String("string"),
    	Size:      pulumi.Int(0),
    	Name:      pulumi.String("string"),
    	User:      pulumi.String("string"),
    })
    
    var databaseConnectionPoolResource = new DatabaseConnectionPool("databaseConnectionPoolResource", DatabaseConnectionPoolArgs.builder()
        .clusterId("string")
        .dbName("string")
        .mode("string")
        .size(0)
        .name("string")
        .user("string")
        .build());
    
    database_connection_pool_resource = digitalocean.DatabaseConnectionPool("databaseConnectionPoolResource",
        cluster_id="string",
        db_name="string",
        mode="string",
        size=0,
        name="string",
        user="string")
    
    const databaseConnectionPoolResource = new digitalocean.DatabaseConnectionPool("databaseConnectionPoolResource", {
        clusterId: "string",
        dbName: "string",
        mode: "string",
        size: 0,
        name: "string",
        user: "string",
    });
    
    type: digitalocean:DatabaseConnectionPool
    properties:
        clusterId: string
        dbName: string
        mode: string
        name: string
        size: 0
        user: string
    

    DatabaseConnectionPool Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The DatabaseConnectionPool resource accepts the following input properties:

    ClusterId string
    The ID of the source database cluster. Note: This must be a PostgreSQL cluster.
    DbName string
    The database for use with the connection pool.
    Mode string
    The PGBouncer transaction mode for the connection pool. The allowed values are session, transaction, and statement.
    Size int
    The desired size of the PGBouncer connection pool.
    Name string
    The name for the database connection pool.
    User string
    The name of the database user for use with the connection pool. When excluded, all sessions connect to the database as the inbound user.
    ClusterId string
    The ID of the source database cluster. Note: This must be a PostgreSQL cluster.
    DbName string
    The database for use with the connection pool.
    Mode string
    The PGBouncer transaction mode for the connection pool. The allowed values are session, transaction, and statement.
    Size int
    The desired size of the PGBouncer connection pool.
    Name string
    The name for the database connection pool.
    User string
    The name of the database user for use with the connection pool. When excluded, all sessions connect to the database as the inbound user.
    clusterId String
    The ID of the source database cluster. Note: This must be a PostgreSQL cluster.
    dbName String
    The database for use with the connection pool.
    mode String
    The PGBouncer transaction mode for the connection pool. The allowed values are session, transaction, and statement.
    size Integer
    The desired size of the PGBouncer connection pool.
    name String
    The name for the database connection pool.
    user String
    The name of the database user for use with the connection pool. When excluded, all sessions connect to the database as the inbound user.
    clusterId string
    The ID of the source database cluster. Note: This must be a PostgreSQL cluster.
    dbName string
    The database for use with the connection pool.
    mode string
    The PGBouncer transaction mode for the connection pool. The allowed values are session, transaction, and statement.
    size number
    The desired size of the PGBouncer connection pool.
    name string
    The name for the database connection pool.
    user string
    The name of the database user for use with the connection pool. When excluded, all sessions connect to the database as the inbound user.
    cluster_id str
    The ID of the source database cluster. Note: This must be a PostgreSQL cluster.
    db_name str
    The database for use with the connection pool.
    mode str
    The PGBouncer transaction mode for the connection pool. The allowed values are session, transaction, and statement.
    size int
    The desired size of the PGBouncer connection pool.
    name str
    The name for the database connection pool.
    user str
    The name of the database user for use with the connection pool. When excluded, all sessions connect to the database as the inbound user.
    clusterId String
    The ID of the source database cluster. Note: This must be a PostgreSQL cluster.
    dbName String
    The database for use with the connection pool.
    mode String
    The PGBouncer transaction mode for the connection pool. The allowed values are session, transaction, and statement.
    size Number
    The desired size of the PGBouncer connection pool.
    name String
    The name for the database connection pool.
    user String
    The name of the database user for use with the connection pool. When excluded, all sessions connect to the database as the inbound user.

    Outputs

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

    Host string
    The hostname used to connect to the database connection pool.
    Id string
    The provider-assigned unique ID for this managed resource.
    Password string
    Password for the connection pool's user.
    Port int
    Network port that the database connection pool is listening on.
    PrivateHost string
    Same as host, but only accessible from resources within the account and in the same region.
    PrivateUri string
    Same as uri, but only accessible from resources within the account and in the same region.
    Uri string
    The full URI for connecting to the database connection pool.
    Host string
    The hostname used to connect to the database connection pool.
    Id string
    The provider-assigned unique ID for this managed resource.
    Password string
    Password for the connection pool's user.
    Port int
    Network port that the database connection pool is listening on.
    PrivateHost string
    Same as host, but only accessible from resources within the account and in the same region.
    PrivateUri string
    Same as uri, but only accessible from resources within the account and in the same region.
    Uri string
    The full URI for connecting to the database connection pool.
    host String
    The hostname used to connect to the database connection pool.
    id String
    The provider-assigned unique ID for this managed resource.
    password String
    Password for the connection pool's user.
    port Integer
    Network port that the database connection pool is listening on.
    privateHost String
    Same as host, but only accessible from resources within the account and in the same region.
    privateUri String
    Same as uri, but only accessible from resources within the account and in the same region.
    uri String
    The full URI for connecting to the database connection pool.
    host string
    The hostname used to connect to the database connection pool.
    id string
    The provider-assigned unique ID for this managed resource.
    password string
    Password for the connection pool's user.
    port number
    Network port that the database connection pool is listening on.
    privateHost string
    Same as host, but only accessible from resources within the account and in the same region.
    privateUri string
    Same as uri, but only accessible from resources within the account and in the same region.
    uri string
    The full URI for connecting to the database connection pool.
    host str
    The hostname used to connect to the database connection pool.
    id str
    The provider-assigned unique ID for this managed resource.
    password str
    Password for the connection pool's user.
    port int
    Network port that the database connection pool is listening on.
    private_host str
    Same as host, but only accessible from resources within the account and in the same region.
    private_uri str
    Same as uri, but only accessible from resources within the account and in the same region.
    uri str
    The full URI for connecting to the database connection pool.
    host String
    The hostname used to connect to the database connection pool.
    id String
    The provider-assigned unique ID for this managed resource.
    password String
    Password for the connection pool's user.
    port Number
    Network port that the database connection pool is listening on.
    privateHost String
    Same as host, but only accessible from resources within the account and in the same region.
    privateUri String
    Same as uri, but only accessible from resources within the account and in the same region.
    uri String
    The full URI for connecting to the database connection pool.

    Look up Existing DatabaseConnectionPool Resource

    Get an existing DatabaseConnectionPool 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?: DatabaseConnectionPoolState, opts?: CustomResourceOptions): DatabaseConnectionPool
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            cluster_id: Optional[str] = None,
            db_name: Optional[str] = None,
            host: Optional[str] = None,
            mode: Optional[str] = None,
            name: Optional[str] = None,
            password: Optional[str] = None,
            port: Optional[int] = None,
            private_host: Optional[str] = None,
            private_uri: Optional[str] = None,
            size: Optional[int] = None,
            uri: Optional[str] = None,
            user: Optional[str] = None) -> DatabaseConnectionPool
    func GetDatabaseConnectionPool(ctx *Context, name string, id IDInput, state *DatabaseConnectionPoolState, opts ...ResourceOption) (*DatabaseConnectionPool, error)
    public static DatabaseConnectionPool Get(string name, Input<string> id, DatabaseConnectionPoolState? state, CustomResourceOptions? opts = null)
    public static DatabaseConnectionPool get(String name, Output<String> id, DatabaseConnectionPoolState 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:
    ClusterId string
    The ID of the source database cluster. Note: This must be a PostgreSQL cluster.
    DbName string
    The database for use with the connection pool.
    Host string
    The hostname used to connect to the database connection pool.
    Mode string
    The PGBouncer transaction mode for the connection pool. The allowed values are session, transaction, and statement.
    Name string
    The name for the database connection pool.
    Password string
    Password for the connection pool's user.
    Port int
    Network port that the database connection pool is listening on.
    PrivateHost string
    Same as host, but only accessible from resources within the account and in the same region.
    PrivateUri string
    Same as uri, but only accessible from resources within the account and in the same region.
    Size int
    The desired size of the PGBouncer connection pool.
    Uri string
    The full URI for connecting to the database connection pool.
    User string
    The name of the database user for use with the connection pool. When excluded, all sessions connect to the database as the inbound user.
    ClusterId string
    The ID of the source database cluster. Note: This must be a PostgreSQL cluster.
    DbName string
    The database for use with the connection pool.
    Host string
    The hostname used to connect to the database connection pool.
    Mode string
    The PGBouncer transaction mode for the connection pool. The allowed values are session, transaction, and statement.
    Name string
    The name for the database connection pool.
    Password string
    Password for the connection pool's user.
    Port int
    Network port that the database connection pool is listening on.
    PrivateHost string
    Same as host, but only accessible from resources within the account and in the same region.
    PrivateUri string
    Same as uri, but only accessible from resources within the account and in the same region.
    Size int
    The desired size of the PGBouncer connection pool.
    Uri string
    The full URI for connecting to the database connection pool.
    User string
    The name of the database user for use with the connection pool. When excluded, all sessions connect to the database as the inbound user.
    clusterId String
    The ID of the source database cluster. Note: This must be a PostgreSQL cluster.
    dbName String
    The database for use with the connection pool.
    host String
    The hostname used to connect to the database connection pool.
    mode String
    The PGBouncer transaction mode for the connection pool. The allowed values are session, transaction, and statement.
    name String
    The name for the database connection pool.
    password String
    Password for the connection pool's user.
    port Integer
    Network port that the database connection pool is listening on.
    privateHost String
    Same as host, but only accessible from resources within the account and in the same region.
    privateUri String
    Same as uri, but only accessible from resources within the account and in the same region.
    size Integer
    The desired size of the PGBouncer connection pool.
    uri String
    The full URI for connecting to the database connection pool.
    user String
    The name of the database user for use with the connection pool. When excluded, all sessions connect to the database as the inbound user.
    clusterId string
    The ID of the source database cluster. Note: This must be a PostgreSQL cluster.
    dbName string
    The database for use with the connection pool.
    host string
    The hostname used to connect to the database connection pool.
    mode string
    The PGBouncer transaction mode for the connection pool. The allowed values are session, transaction, and statement.
    name string
    The name for the database connection pool.
    password string
    Password for the connection pool's user.
    port number
    Network port that the database connection pool is listening on.
    privateHost string
    Same as host, but only accessible from resources within the account and in the same region.
    privateUri string
    Same as uri, but only accessible from resources within the account and in the same region.
    size number
    The desired size of the PGBouncer connection pool.
    uri string
    The full URI for connecting to the database connection pool.
    user string
    The name of the database user for use with the connection pool. When excluded, all sessions connect to the database as the inbound user.
    cluster_id str
    The ID of the source database cluster. Note: This must be a PostgreSQL cluster.
    db_name str
    The database for use with the connection pool.
    host str
    The hostname used to connect to the database connection pool.
    mode str
    The PGBouncer transaction mode for the connection pool. The allowed values are session, transaction, and statement.
    name str
    The name for the database connection pool.
    password str
    Password for the connection pool's user.
    port int
    Network port that the database connection pool is listening on.
    private_host str
    Same as host, but only accessible from resources within the account and in the same region.
    private_uri str
    Same as uri, but only accessible from resources within the account and in the same region.
    size int
    The desired size of the PGBouncer connection pool.
    uri str
    The full URI for connecting to the database connection pool.
    user str
    The name of the database user for use with the connection pool. When excluded, all sessions connect to the database as the inbound user.
    clusterId String
    The ID of the source database cluster. Note: This must be a PostgreSQL cluster.
    dbName String
    The database for use with the connection pool.
    host String
    The hostname used to connect to the database connection pool.
    mode String
    The PGBouncer transaction mode for the connection pool. The allowed values are session, transaction, and statement.
    name String
    The name for the database connection pool.
    password String
    Password for the connection pool's user.
    port Number
    Network port that the database connection pool is listening on.
    privateHost String
    Same as host, but only accessible from resources within the account and in the same region.
    privateUri String
    Same as uri, but only accessible from resources within the account and in the same region.
    size Number
    The desired size of the PGBouncer connection pool.
    uri String
    The full URI for connecting to the database connection pool.
    user String
    The name of the database user for use with the connection pool. When excluded, all sessions connect to the database as the inbound user.

    Import

    Database connection pools can be imported using the id of the source database cluster

    and the name of the connection pool joined with a comma. For example:

    $ pulumi import digitalocean:index/databaseConnectionPool:DatabaseConnectionPool pool-01 245bcfd0-7f31-4ce6-a2bc-475a116cca97,pool-01
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    DigitalOcean pulumi/pulumi-digitalocean
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the digitalocean Terraform Provider.
    digitalocean logo
    DigitalOcean v4.36.0 published on Wednesday, Dec 4, 2024 by Pulumi