1. Packages
  2. Digitalocean Provider
  3. API Docs
  4. DatabaseUser
DigitalOcean v4.35.0 published on Tuesday, Nov 19, 2024 by Pulumi

digitalocean.DatabaseUser

Explore with Pulumi AI

digitalocean logo
DigitalOcean v4.35.0 published on Tuesday, Nov 19, 2024 by Pulumi

    Provides a DigitalOcean database user resource. When creating a new database cluster, a default admin user with name doadmin will be created. Then, this resource can be used to provide additional normal users inside the cluster.

    NOTE: Any new users created will always have normal role, only the default user that comes with database cluster creation has primary role. Additional permissions must be managed manually.

    Example Usage

    Create a new PostgreSQL database user

    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 user_example = new digitalocean.DatabaseUser("user-example", {
        clusterId: postgres_example.id,
        name: "foobar",
    });
    
    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)
    user_example = digitalocean.DatabaseUser("user-example",
        cluster_id=postgres_example.id,
        name="foobar")
    
    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.NewDatabaseUser(ctx, "user-example", &digitalocean.DatabaseUserArgs{
    			ClusterId: postgres_example.ID(),
    			Name:      pulumi.String("foobar"),
    		})
    		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 user_example = new DigitalOcean.DatabaseUser("user-example", new()
        {
            ClusterId = postgres_example.Id,
            Name = "foobar",
        });
    
    });
    
    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.DatabaseUser;
    import com.pulumi.digitalocean.DatabaseUserArgs;
    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 user_example = new DatabaseUser("user-example", DatabaseUserArgs.builder()
                .clusterId(postgres_example.id())
                .name("foobar")
                .build());
    
        }
    }
    
    resources:
      user-example:
        type: digitalocean:DatabaseUser
        properties:
          clusterId: ${["postgres-example"].id}
          name: foobar
      postgres-example:
        type: digitalocean:DatabaseCluster
        properties:
          name: example-postgres-cluster
          engine: pg
          version: '15'
          size: db-s-1vcpu-1gb
          region: nyc1
          nodeCount: 1
    

    Create a new user for a PostgreSQL database replica

    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 replica_example = new digitalocean.DatabaseReplica("replica-example", {
        clusterId: postgres_example.id,
        name: "replica-example",
        size: digitalocean.DatabaseSlug.DB_1VPCU1GB,
        region: digitalocean.Region.NYC1,
    });
    const user_example = new digitalocean.DatabaseUser("user-example", {
        clusterId: replica_example.uuid,
        name: "foobar",
    });
    
    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)
    replica_example = digitalocean.DatabaseReplica("replica-example",
        cluster_id=postgres_example.id,
        name="replica-example",
        size=digitalocean.DatabaseSlug.D_B_1_VPCU1_GB,
        region=digitalocean.Region.NYC1)
    user_example = digitalocean.DatabaseUser("user-example",
        cluster_id=replica_example.uuid,
        name="foobar")
    
    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.NewDatabaseReplica(ctx, "replica-example", &digitalocean.DatabaseReplicaArgs{
    			ClusterId: postgres_example.ID(),
    			Name:      pulumi.String("replica-example"),
    			Size:      pulumi.String(digitalocean.DatabaseSlug_DB_1VPCU1GB),
    			Region:    pulumi.String(digitalocean.RegionNYC1),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = digitalocean.NewDatabaseUser(ctx, "user-example", &digitalocean.DatabaseUserArgs{
    			ClusterId: replica_example.Uuid,
    			Name:      pulumi.String("foobar"),
    		})
    		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 replica_example = new DigitalOcean.DatabaseReplica("replica-example", new()
        {
            ClusterId = postgres_example.Id,
            Name = "replica-example",
            Size = DigitalOcean.DatabaseSlug.DB_1VPCU1GB,
            Region = DigitalOcean.Region.NYC1,
        });
    
        var user_example = new DigitalOcean.DatabaseUser("user-example", new()
        {
            ClusterId = replica_example.Uuid,
            Name = "foobar",
        });
    
    });
    
    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.DatabaseReplica;
    import com.pulumi.digitalocean.DatabaseReplicaArgs;
    import com.pulumi.digitalocean.DatabaseUser;
    import com.pulumi.digitalocean.DatabaseUserArgs;
    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 replica_example = new DatabaseReplica("replica-example", DatabaseReplicaArgs.builder()
                .clusterId(postgres_example.id())
                .name("replica-example")
                .size("db-s-1vcpu-1gb")
                .region("nyc1")
                .build());
    
            var user_example = new DatabaseUser("user-example", DatabaseUserArgs.builder()
                .clusterId(replica_example.uuid())
                .name("foobar")
                .build());
    
        }
    }
    
    resources:
      postgres-example:
        type: digitalocean:DatabaseCluster
        properties:
          name: example-postgres-cluster
          engine: pg
          version: '15'
          size: db-s-1vcpu-1gb
          region: nyc1
          nodeCount: 1
      replica-example:
        type: digitalocean:DatabaseReplica
        properties:
          clusterId: ${["postgres-example"].id}
          name: replica-example
          size: db-s-1vcpu-1gb
          region: nyc1
      user-example:
        type: digitalocean:DatabaseUser
        properties:
          clusterId: ${["replica-example"].uuid}
          name: foobar
    

    Create a new user for a Kafka database cluster

    import * as pulumi from "@pulumi/pulumi";
    import * as digitalocean from "@pulumi/digitalocean";
    
    const kafka_example = new digitalocean.DatabaseCluster("kafka-example", {
        name: "example-kafka-cluster",
        engine: "kafka",
        version: "3.5",
        size: "db-s-2vcpu-2gb",
        region: digitalocean.Region.NYC1,
        nodeCount: 3,
    });
    const foobarTopic = new digitalocean.DatabaseKafkaTopic("foobar_topic", {
        clusterId: foobar.id,
        name: "topic-1",
    });
    const foobarUser = new digitalocean.DatabaseUser("foobar_user", {
        clusterId: foobar.id,
        name: "example-user",
        settings: [{
            acls: [
                {
                    topic: "topic-1",
                    permission: "produce",
                },
                {
                    topic: "topic-2",
                    permission: "produceconsume",
                },
                {
                    topic: "topic-*",
                    permission: "consume",
                },
            ],
        }],
    });
    
    import pulumi
    import pulumi_digitalocean as digitalocean
    
    kafka_example = digitalocean.DatabaseCluster("kafka-example",
        name="example-kafka-cluster",
        engine="kafka",
        version="3.5",
        size="db-s-2vcpu-2gb",
        region=digitalocean.Region.NYC1,
        node_count=3)
    foobar_topic = digitalocean.DatabaseKafkaTopic("foobar_topic",
        cluster_id=foobar["id"],
        name="topic-1")
    foobar_user = digitalocean.DatabaseUser("foobar_user",
        cluster_id=foobar["id"],
        name="example-user",
        settings=[{
            "acls": [
                {
                    "topic": "topic-1",
                    "permission": "produce",
                },
                {
                    "topic": "topic-2",
                    "permission": "produceconsume",
                },
                {
                    "topic": "topic-*",
                    "permission": "consume",
                },
            ],
        }])
    
    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, "kafka-example", &digitalocean.DatabaseClusterArgs{
    			Name:      pulumi.String("example-kafka-cluster"),
    			Engine:    pulumi.String("kafka"),
    			Version:   pulumi.String("3.5"),
    			Size:      pulumi.String("db-s-2vcpu-2gb"),
    			Region:    pulumi.String(digitalocean.RegionNYC1),
    			NodeCount: pulumi.Int(3),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = digitalocean.NewDatabaseKafkaTopic(ctx, "foobar_topic", &digitalocean.DatabaseKafkaTopicArgs{
    			ClusterId: pulumi.Any(foobar.Id),
    			Name:      pulumi.String("topic-1"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = digitalocean.NewDatabaseUser(ctx, "foobar_user", &digitalocean.DatabaseUserArgs{
    			ClusterId: pulumi.Any(foobar.Id),
    			Name:      pulumi.String("example-user"),
    			Settings: digitalocean.DatabaseUserSettingArray{
    				&digitalocean.DatabaseUserSettingArgs{
    					Acls: digitalocean.DatabaseUserSettingAclArray{
    						&digitalocean.DatabaseUserSettingAclArgs{
    							Topic:      pulumi.String("topic-1"),
    							Permission: pulumi.String("produce"),
    						},
    						&digitalocean.DatabaseUserSettingAclArgs{
    							Topic:      pulumi.String("topic-2"),
    							Permission: pulumi.String("produceconsume"),
    						},
    						&digitalocean.DatabaseUserSettingAclArgs{
    							Topic:      pulumi.String("topic-*"),
    							Permission: pulumi.String("consume"),
    						},
    					},
    				},
    			},
    		})
    		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 kafka_example = new DigitalOcean.DatabaseCluster("kafka-example", new()
        {
            Name = "example-kafka-cluster",
            Engine = "kafka",
            Version = "3.5",
            Size = "db-s-2vcpu-2gb",
            Region = DigitalOcean.Region.NYC1,
            NodeCount = 3,
        });
    
        var foobarTopic = new DigitalOcean.DatabaseKafkaTopic("foobar_topic", new()
        {
            ClusterId = foobar.Id,
            Name = "topic-1",
        });
    
        var foobarUser = new DigitalOcean.DatabaseUser("foobar_user", new()
        {
            ClusterId = foobar.Id,
            Name = "example-user",
            Settings = new[]
            {
                new DigitalOcean.Inputs.DatabaseUserSettingArgs
                {
                    Acls = new[]
                    {
                        new DigitalOcean.Inputs.DatabaseUserSettingAclArgs
                        {
                            Topic = "topic-1",
                            Permission = "produce",
                        },
                        new DigitalOcean.Inputs.DatabaseUserSettingAclArgs
                        {
                            Topic = "topic-2",
                            Permission = "produceconsume",
                        },
                        new DigitalOcean.Inputs.DatabaseUserSettingAclArgs
                        {
                            Topic = "topic-*",
                            Permission = "consume",
                        },
                    },
                },
            },
        });
    
    });
    
    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.DatabaseKafkaTopic;
    import com.pulumi.digitalocean.DatabaseKafkaTopicArgs;
    import com.pulumi.digitalocean.DatabaseUser;
    import com.pulumi.digitalocean.DatabaseUserArgs;
    import com.pulumi.digitalocean.inputs.DatabaseUserSettingArgs;
    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 kafka_example = new DatabaseCluster("kafka-example", DatabaseClusterArgs.builder()
                .name("example-kafka-cluster")
                .engine("kafka")
                .version("3.5")
                .size("db-s-2vcpu-2gb")
                .region("nyc1")
                .nodeCount(3)
                .build());
    
            var foobarTopic = new DatabaseKafkaTopic("foobarTopic", DatabaseKafkaTopicArgs.builder()
                .clusterId(foobar.id())
                .name("topic-1")
                .build());
    
            var foobarUser = new DatabaseUser("foobarUser", DatabaseUserArgs.builder()
                .clusterId(foobar.id())
                .name("example-user")
                .settings(DatabaseUserSettingArgs.builder()
                    .acls(                
                        DatabaseUserSettingAclArgs.builder()
                            .topic("topic-1")
                            .permission("produce")
                            .build(),
                        DatabaseUserSettingAclArgs.builder()
                            .topic("topic-2")
                            .permission("produceconsume")
                            .build(),
                        DatabaseUserSettingAclArgs.builder()
                            .topic("topic-*")
                            .permission("consume")
                            .build())
                    .build())
                .build());
    
        }
    }
    
    resources:
      kafka-example:
        type: digitalocean:DatabaseCluster
        properties:
          name: example-kafka-cluster
          engine: kafka
          version: '3.5'
          size: db-s-2vcpu-2gb
          region: nyc1
          nodeCount: 3
      foobarTopic:
        type: digitalocean:DatabaseKafkaTopic
        name: foobar_topic
        properties:
          clusterId: ${foobar.id}
          name: topic-1
      foobarUser:
        type: digitalocean:DatabaseUser
        name: foobar_user
        properties:
          clusterId: ${foobar.id}
          name: example-user
          settings:
            - acls:
                - topic: topic-1
                  permission: produce
                - topic: topic-2
                  permission: produceconsume
                - topic: topic-*
                  permission: consume
    

    Create DatabaseUser Resource

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

    Constructor syntax

    new DatabaseUser(name: string, args: DatabaseUserArgs, opts?: CustomResourceOptions);
    @overload
    def DatabaseUser(resource_name: str,
                     args: DatabaseUserArgs,
                     opts: Optional[ResourceOptions] = None)
    
    @overload
    def DatabaseUser(resource_name: str,
                     opts: Optional[ResourceOptions] = None,
                     cluster_id: Optional[str] = None,
                     mysql_auth_plugin: Optional[str] = None,
                     name: Optional[str] = None,
                     settings: Optional[Sequence[DatabaseUserSettingArgs]] = None)
    func NewDatabaseUser(ctx *Context, name string, args DatabaseUserArgs, opts ...ResourceOption) (*DatabaseUser, error)
    public DatabaseUser(string name, DatabaseUserArgs args, CustomResourceOptions? opts = null)
    public DatabaseUser(String name, DatabaseUserArgs args)
    public DatabaseUser(String name, DatabaseUserArgs args, CustomResourceOptions options)
    
    type: digitalocean:DatabaseUser
    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 DatabaseUserArgs
    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 DatabaseUserArgs
    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 DatabaseUserArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args DatabaseUserArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args DatabaseUserArgs
    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 databaseUserResource = new DigitalOcean.DatabaseUser("databaseUserResource", new()
    {
        ClusterId = "string",
        MysqlAuthPlugin = "string",
        Name = "string",
        Settings = new[]
        {
            new DigitalOcean.Inputs.DatabaseUserSettingArgs
            {
                Acls = new[]
                {
                    new DigitalOcean.Inputs.DatabaseUserSettingAclArgs
                    {
                        Permission = "string",
                        Topic = "string",
                        Id = "string",
                    },
                },
                OpensearchAcls = new[]
                {
                    new DigitalOcean.Inputs.DatabaseUserSettingOpensearchAclArgs
                    {
                        Index = "string",
                        Permission = "string",
                    },
                },
            },
        },
    });
    
    example, err := digitalocean.NewDatabaseUser(ctx, "databaseUserResource", &digitalocean.DatabaseUserArgs{
    	ClusterId:       pulumi.String("string"),
    	MysqlAuthPlugin: pulumi.String("string"),
    	Name:            pulumi.String("string"),
    	Settings: digitalocean.DatabaseUserSettingArray{
    		&digitalocean.DatabaseUserSettingArgs{
    			Acls: digitalocean.DatabaseUserSettingAclArray{
    				&digitalocean.DatabaseUserSettingAclArgs{
    					Permission: pulumi.String("string"),
    					Topic:      pulumi.String("string"),
    					Id:         pulumi.String("string"),
    				},
    			},
    			OpensearchAcls: digitalocean.DatabaseUserSettingOpensearchAclArray{
    				&digitalocean.DatabaseUserSettingOpensearchAclArgs{
    					Index:      pulumi.String("string"),
    					Permission: pulumi.String("string"),
    				},
    			},
    		},
    	},
    })
    
    var databaseUserResource = new DatabaseUser("databaseUserResource", DatabaseUserArgs.builder()
        .clusterId("string")
        .mysqlAuthPlugin("string")
        .name("string")
        .settings(DatabaseUserSettingArgs.builder()
            .acls(DatabaseUserSettingAclArgs.builder()
                .permission("string")
                .topic("string")
                .id("string")
                .build())
            .opensearchAcls(DatabaseUserSettingOpensearchAclArgs.builder()
                .index("string")
                .permission("string")
                .build())
            .build())
        .build());
    
    database_user_resource = digitalocean.DatabaseUser("databaseUserResource",
        cluster_id="string",
        mysql_auth_plugin="string",
        name="string",
        settings=[{
            "acls": [{
                "permission": "string",
                "topic": "string",
                "id": "string",
            }],
            "opensearch_acls": [{
                "index": "string",
                "permission": "string",
            }],
        }])
    
    const databaseUserResource = new digitalocean.DatabaseUser("databaseUserResource", {
        clusterId: "string",
        mysqlAuthPlugin: "string",
        name: "string",
        settings: [{
            acls: [{
                permission: "string",
                topic: "string",
                id: "string",
            }],
            opensearchAcls: [{
                index: "string",
                permission: "string",
            }],
        }],
    });
    
    type: digitalocean:DatabaseUser
    properties:
        clusterId: string
        mysqlAuthPlugin: string
        name: string
        settings:
            - acls:
                - id: string
                  permission: string
                  topic: string
              opensearchAcls:
                - index: string
                  permission: string
    

    DatabaseUser 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 DatabaseUser resource accepts the following input properties:

    ClusterId string
    The ID of the original source database cluster.
    MysqlAuthPlugin string
    The authentication method to use for connections to the MySQL user account. The valid values are mysql_native_password or caching_sha2_password (this is the default).
    Name string
    The name for the database user.
    Settings List<Pulumi.DigitalOcean.Inputs.DatabaseUserSetting>
    Contains optional settings for the user. The settings block is documented below.
    ClusterId string
    The ID of the original source database cluster.
    MysqlAuthPlugin string
    The authentication method to use for connections to the MySQL user account. The valid values are mysql_native_password or caching_sha2_password (this is the default).
    Name string
    The name for the database user.
    Settings []DatabaseUserSettingArgs
    Contains optional settings for the user. The settings block is documented below.
    clusterId String
    The ID of the original source database cluster.
    mysqlAuthPlugin String
    The authentication method to use for connections to the MySQL user account. The valid values are mysql_native_password or caching_sha2_password (this is the default).
    name String
    The name for the database user.
    settings List<DatabaseUserSetting>
    Contains optional settings for the user. The settings block is documented below.
    clusterId string
    The ID of the original source database cluster.
    mysqlAuthPlugin string
    The authentication method to use for connections to the MySQL user account. The valid values are mysql_native_password or caching_sha2_password (this is the default).
    name string
    The name for the database user.
    settings DatabaseUserSetting[]
    Contains optional settings for the user. The settings block is documented below.
    cluster_id str
    The ID of the original source database cluster.
    mysql_auth_plugin str
    The authentication method to use for connections to the MySQL user account. The valid values are mysql_native_password or caching_sha2_password (this is the default).
    name str
    The name for the database user.
    settings Sequence[DatabaseUserSettingArgs]
    Contains optional settings for the user. The settings block is documented below.
    clusterId String
    The ID of the original source database cluster.
    mysqlAuthPlugin String
    The authentication method to use for connections to the MySQL user account. The valid values are mysql_native_password or caching_sha2_password (this is the default).
    name String
    The name for the database user.
    settings List<Property Map>
    Contains optional settings for the user. The settings block is documented below.

    Outputs

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

    AccessCert string
    Access certificate for TLS client authentication. (Kafka only)
    AccessKey string
    Access key for TLS client authentication. (Kafka only)
    Id string
    The provider-assigned unique ID for this managed resource.
    Password string
    Password for the database user.
    Role string
    Role for the database user. The value will be either "primary" or "normal".
    AccessCert string
    Access certificate for TLS client authentication. (Kafka only)
    AccessKey string
    Access key for TLS client authentication. (Kafka only)
    Id string
    The provider-assigned unique ID for this managed resource.
    Password string
    Password for the database user.
    Role string
    Role for the database user. The value will be either "primary" or "normal".
    accessCert String
    Access certificate for TLS client authentication. (Kafka only)
    accessKey String
    Access key for TLS client authentication. (Kafka only)
    id String
    The provider-assigned unique ID for this managed resource.
    password String
    Password for the database user.
    role String
    Role for the database user. The value will be either "primary" or "normal".
    accessCert string
    Access certificate for TLS client authentication. (Kafka only)
    accessKey string
    Access key for TLS client authentication. (Kafka only)
    id string
    The provider-assigned unique ID for this managed resource.
    password string
    Password for the database user.
    role string
    Role for the database user. The value will be either "primary" or "normal".
    access_cert str
    Access certificate for TLS client authentication. (Kafka only)
    access_key str
    Access key for TLS client authentication. (Kafka only)
    id str
    The provider-assigned unique ID for this managed resource.
    password str
    Password for the database user.
    role str
    Role for the database user. The value will be either "primary" or "normal".
    accessCert String
    Access certificate for TLS client authentication. (Kafka only)
    accessKey String
    Access key for TLS client authentication. (Kafka only)
    id String
    The provider-assigned unique ID for this managed resource.
    password String
    Password for the database user.
    role String
    Role for the database user. The value will be either "primary" or "normal".

    Look up Existing DatabaseUser Resource

    Get an existing DatabaseUser 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?: DatabaseUserState, opts?: CustomResourceOptions): DatabaseUser
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            access_cert: Optional[str] = None,
            access_key: Optional[str] = None,
            cluster_id: Optional[str] = None,
            mysql_auth_plugin: Optional[str] = None,
            name: Optional[str] = None,
            password: Optional[str] = None,
            role: Optional[str] = None,
            settings: Optional[Sequence[DatabaseUserSettingArgs]] = None) -> DatabaseUser
    func GetDatabaseUser(ctx *Context, name string, id IDInput, state *DatabaseUserState, opts ...ResourceOption) (*DatabaseUser, error)
    public static DatabaseUser Get(string name, Input<string> id, DatabaseUserState? state, CustomResourceOptions? opts = null)
    public static DatabaseUser get(String name, Output<String> id, DatabaseUserState 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:
    AccessCert string
    Access certificate for TLS client authentication. (Kafka only)
    AccessKey string
    Access key for TLS client authentication. (Kafka only)
    ClusterId string
    The ID of the original source database cluster.
    MysqlAuthPlugin string
    The authentication method to use for connections to the MySQL user account. The valid values are mysql_native_password or caching_sha2_password (this is the default).
    Name string
    The name for the database user.
    Password string
    Password for the database user.
    Role string
    Role for the database user. The value will be either "primary" or "normal".
    Settings List<Pulumi.DigitalOcean.Inputs.DatabaseUserSetting>
    Contains optional settings for the user. The settings block is documented below.
    AccessCert string
    Access certificate for TLS client authentication. (Kafka only)
    AccessKey string
    Access key for TLS client authentication. (Kafka only)
    ClusterId string
    The ID of the original source database cluster.
    MysqlAuthPlugin string
    The authentication method to use for connections to the MySQL user account. The valid values are mysql_native_password or caching_sha2_password (this is the default).
    Name string
    The name for the database user.
    Password string
    Password for the database user.
    Role string
    Role for the database user. The value will be either "primary" or "normal".
    Settings []DatabaseUserSettingArgs
    Contains optional settings for the user. The settings block is documented below.
    accessCert String
    Access certificate for TLS client authentication. (Kafka only)
    accessKey String
    Access key for TLS client authentication. (Kafka only)
    clusterId String
    The ID of the original source database cluster.
    mysqlAuthPlugin String
    The authentication method to use for connections to the MySQL user account. The valid values are mysql_native_password or caching_sha2_password (this is the default).
    name String
    The name for the database user.
    password String
    Password for the database user.
    role String
    Role for the database user. The value will be either "primary" or "normal".
    settings List<DatabaseUserSetting>
    Contains optional settings for the user. The settings block is documented below.
    accessCert string
    Access certificate for TLS client authentication. (Kafka only)
    accessKey string
    Access key for TLS client authentication. (Kafka only)
    clusterId string
    The ID of the original source database cluster.
    mysqlAuthPlugin string
    The authentication method to use for connections to the MySQL user account. The valid values are mysql_native_password or caching_sha2_password (this is the default).
    name string
    The name for the database user.
    password string
    Password for the database user.
    role string
    Role for the database user. The value will be either "primary" or "normal".
    settings DatabaseUserSetting[]
    Contains optional settings for the user. The settings block is documented below.
    access_cert str
    Access certificate for TLS client authentication. (Kafka only)
    access_key str
    Access key for TLS client authentication. (Kafka only)
    cluster_id str
    The ID of the original source database cluster.
    mysql_auth_plugin str
    The authentication method to use for connections to the MySQL user account. The valid values are mysql_native_password or caching_sha2_password (this is the default).
    name str
    The name for the database user.
    password str
    Password for the database user.
    role str
    Role for the database user. The value will be either "primary" or "normal".
    settings Sequence[DatabaseUserSettingArgs]
    Contains optional settings for the user. The settings block is documented below.
    accessCert String
    Access certificate for TLS client authentication. (Kafka only)
    accessKey String
    Access key for TLS client authentication. (Kafka only)
    clusterId String
    The ID of the original source database cluster.
    mysqlAuthPlugin String
    The authentication method to use for connections to the MySQL user account. The valid values are mysql_native_password or caching_sha2_password (this is the default).
    name String
    The name for the database user.
    password String
    Password for the database user.
    role String
    Role for the database user. The value will be either "primary" or "normal".
    settings List<Property Map>
    Contains optional settings for the user. The settings block is documented below.

    Supporting Types

    DatabaseUserSetting, DatabaseUserSettingArgs

    Acls List<Pulumi.DigitalOcean.Inputs.DatabaseUserSettingAcl>

    A set of ACLs (Access Control Lists) specifying permission on topics with a Kafka cluster. The properties of an individual ACL are described below:

    An individual ACL includes the following:

    OpensearchAcls List<Pulumi.DigitalOcean.Inputs.DatabaseUserSettingOpensearchAcl>
    Acls []DatabaseUserSettingAcl

    A set of ACLs (Access Control Lists) specifying permission on topics with a Kafka cluster. The properties of an individual ACL are described below:

    An individual ACL includes the following:

    OpensearchAcls []DatabaseUserSettingOpensearchAcl
    acls List<DatabaseUserSettingAcl>

    A set of ACLs (Access Control Lists) specifying permission on topics with a Kafka cluster. The properties of an individual ACL are described below:

    An individual ACL includes the following:

    opensearchAcls List<DatabaseUserSettingOpensearchAcl>
    acls DatabaseUserSettingAcl[]

    A set of ACLs (Access Control Lists) specifying permission on topics with a Kafka cluster. The properties of an individual ACL are described below:

    An individual ACL includes the following:

    opensearchAcls DatabaseUserSettingOpensearchAcl[]
    acls Sequence[DatabaseUserSettingAcl]

    A set of ACLs (Access Control Lists) specifying permission on topics with a Kafka cluster. The properties of an individual ACL are described below:

    An individual ACL includes the following:

    opensearch_acls Sequence[DatabaseUserSettingOpensearchAcl]
    acls List<Property Map>

    A set of ACLs (Access Control Lists) specifying permission on topics with a Kafka cluster. The properties of an individual ACL are described below:

    An individual ACL includes the following:

    opensearchAcls List<Property Map>

    DatabaseUserSettingAcl, DatabaseUserSettingAclArgs

    Permission string
    The permission level applied to the ACL. This includes "admin", "consume", "produce", and "produceconsume". "admin" allows for producing and consuming as well as add/delete/update permission for topics. "consume" allows only for reading topic messages. "produce" allows only for writing topic messages. "produceconsume" allows for both reading and writing topic messages.
    Topic string
    A regex for matching the topic(s) that this ACL should apply to. The regex can assume one of 3 patterns: "", "", or "". "" is a special value indicating a wildcard that matches on all topics. "" defines a regex that matches all topics with the prefix. "" performs an exact match on a topic name and only applies to that topic.
    Id string
    An identifier for the ACL, this will be automatically assigned when you create an ACL entry
    Permission string
    The permission level applied to the ACL. This includes "admin", "consume", "produce", and "produceconsume". "admin" allows for producing and consuming as well as add/delete/update permission for topics. "consume" allows only for reading topic messages. "produce" allows only for writing topic messages. "produceconsume" allows for both reading and writing topic messages.
    Topic string
    A regex for matching the topic(s) that this ACL should apply to. The regex can assume one of 3 patterns: "", "", or "". "" is a special value indicating a wildcard that matches on all topics. "" defines a regex that matches all topics with the prefix. "" performs an exact match on a topic name and only applies to that topic.
    Id string
    An identifier for the ACL, this will be automatically assigned when you create an ACL entry
    permission String
    The permission level applied to the ACL. This includes "admin", "consume", "produce", and "produceconsume". "admin" allows for producing and consuming as well as add/delete/update permission for topics. "consume" allows only for reading topic messages. "produce" allows only for writing topic messages. "produceconsume" allows for both reading and writing topic messages.
    topic String
    A regex for matching the topic(s) that this ACL should apply to. The regex can assume one of 3 patterns: "", "", or "". "" is a special value indicating a wildcard that matches on all topics. "" defines a regex that matches all topics with the prefix. "" performs an exact match on a topic name and only applies to that topic.
    id String
    An identifier for the ACL, this will be automatically assigned when you create an ACL entry
    permission string
    The permission level applied to the ACL. This includes "admin", "consume", "produce", and "produceconsume". "admin" allows for producing and consuming as well as add/delete/update permission for topics. "consume" allows only for reading topic messages. "produce" allows only for writing topic messages. "produceconsume" allows for both reading and writing topic messages.
    topic string
    A regex for matching the topic(s) that this ACL should apply to. The regex can assume one of 3 patterns: "", "", or "". "" is a special value indicating a wildcard that matches on all topics. "" defines a regex that matches all topics with the prefix. "" performs an exact match on a topic name and only applies to that topic.
    id string
    An identifier for the ACL, this will be automatically assigned when you create an ACL entry
    permission str
    The permission level applied to the ACL. This includes "admin", "consume", "produce", and "produceconsume". "admin" allows for producing and consuming as well as add/delete/update permission for topics. "consume" allows only for reading topic messages. "produce" allows only for writing topic messages. "produceconsume" allows for both reading and writing topic messages.
    topic str
    A regex for matching the topic(s) that this ACL should apply to. The regex can assume one of 3 patterns: "", "", or "". "" is a special value indicating a wildcard that matches on all topics. "" defines a regex that matches all topics with the prefix. "" performs an exact match on a topic name and only applies to that topic.
    id str
    An identifier for the ACL, this will be automatically assigned when you create an ACL entry
    permission String
    The permission level applied to the ACL. This includes "admin", "consume", "produce", and "produceconsume". "admin" allows for producing and consuming as well as add/delete/update permission for topics. "consume" allows only for reading topic messages. "produce" allows only for writing topic messages. "produceconsume" allows for both reading and writing topic messages.
    topic String
    A regex for matching the topic(s) that this ACL should apply to. The regex can assume one of 3 patterns: "", "", or "". "" is a special value indicating a wildcard that matches on all topics. "" defines a regex that matches all topics with the prefix. "" performs an exact match on a topic name and only applies to that topic.
    id String
    An identifier for the ACL, this will be automatically assigned when you create an ACL entry

    DatabaseUserSettingOpensearchAcl, DatabaseUserSettingOpensearchAclArgs

    Index string
    Permission string
    The permission level applied to the ACL. This includes "admin", "consume", "produce", and "produceconsume". "admin" allows for producing and consuming as well as add/delete/update permission for topics. "consume" allows only for reading topic messages. "produce" allows only for writing topic messages. "produceconsume" allows for both reading and writing topic messages.
    Index string
    Permission string
    The permission level applied to the ACL. This includes "admin", "consume", "produce", and "produceconsume". "admin" allows for producing and consuming as well as add/delete/update permission for topics. "consume" allows only for reading topic messages. "produce" allows only for writing topic messages. "produceconsume" allows for both reading and writing topic messages.
    index String
    permission String
    The permission level applied to the ACL. This includes "admin", "consume", "produce", and "produceconsume". "admin" allows for producing and consuming as well as add/delete/update permission for topics. "consume" allows only for reading topic messages. "produce" allows only for writing topic messages. "produceconsume" allows for both reading and writing topic messages.
    index string
    permission string
    The permission level applied to the ACL. This includes "admin", "consume", "produce", and "produceconsume". "admin" allows for producing and consuming as well as add/delete/update permission for topics. "consume" allows only for reading topic messages. "produce" allows only for writing topic messages. "produceconsume" allows for both reading and writing topic messages.
    index str
    permission str
    The permission level applied to the ACL. This includes "admin", "consume", "produce", and "produceconsume". "admin" allows for producing and consuming as well as add/delete/update permission for topics. "consume" allows only for reading topic messages. "produce" allows only for writing topic messages. "produceconsume" allows for both reading and writing topic messages.
    index String
    permission String
    The permission level applied to the ACL. This includes "admin", "consume", "produce", and "produceconsume". "admin" allows for producing and consuming as well as add/delete/update permission for topics. "consume" allows only for reading topic messages. "produce" allows only for writing topic messages. "produceconsume" allows for both reading and writing topic messages.

    Import

    Database user can be imported using the id of the source database cluster

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

    $ pulumi import digitalocean:index/databaseUser:DatabaseUser user-example 245bcfd0-7f31-4ce6-a2bc-475a116cca97,foobar
    

    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.35.0 published on Tuesday, Nov 19, 2024 by Pulumi