DatabaseUser
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
normalrole, only the default user that comes with database cluster creation hasprimaryrole. Additional permissions must be managed manually.
Example Usage
Create a new PostgreSQL database user
using Pulumi;
using DigitalOcean = Pulumi.DigitalOcean;
class MyStack : Stack
{
public MyStack()
{
var postgres_example = new DigitalOcean.DatabaseCluster("postgres-example", new DigitalOcean.DatabaseClusterArgs
{
Engine = "pg",
Version = "11",
Size = "db-s-1vcpu-1gb",
Region = "nyc1",
NodeCount = 1,
});
var user_example = new DigitalOcean.DatabaseUser("user-example", new DigitalOcean.DatabaseUserArgs
{
ClusterId = postgres_example.Id,
});
}
}
Coming soon!
import pulumi
import pulumi_digitalocean as digitalocean
postgres_example = digitalocean.DatabaseCluster("postgres-example",
engine="pg",
version="11",
size="db-s-1vcpu-1gb",
region="nyc1",
node_count=1)
user_example = digitalocean.DatabaseUser("user-example", cluster_id=postgres_example.id)import * as pulumi from "@pulumi/pulumi";
import * as digitalocean from "@pulumi/digitalocean";
const postgres_example = new digitalocean.DatabaseCluster("postgres-example", {
engine: "pg",
version: "11",
size: "db-s-1vcpu-1gb",
region: "nyc1",
nodeCount: 1,
});
const user_example = new digitalocean.DatabaseUser("user-example", {clusterId: postgres_example.id});Create a DatabaseUser Resource
new DatabaseUser(name: string, args: DatabaseUserArgs, opts?: CustomResourceOptions);def DatabaseUser(resource_name, opts=None, cluster_id=None, mysql_auth_plugin=None, name=None, __props__=None);func NewDatabaseUser(ctx *Context, name string, args DatabaseUserArgs, opts ...ResourceOption) (*DatabaseUser, error)public DatabaseUser(string name, DatabaseUserArgs args, CustomResourceOptions? opts = null)- 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.
- opts ResourceOptions
- A bag of options that control this resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args 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.
DatabaseUser Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.
Inputs
The DatabaseUser resource accepts the following input properties:
- cluster_
id str The ID of the original source database cluster.
- mysql_
auth_ strplugin The authentication method to use for connections to the MySQL user account. The valid values are
mysql_native_passwordorcaching_sha2_password(this is the default).- name str
The name for the database user.
Outputs
All input properties are implicitly available as output properties. Additionally, the DatabaseUser resource produces the following output properties:
Look up an 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): DatabaseUserstatic get(resource_name, id, opts=None, cluster_id=None, mysql_auth_plugin=None, name=None, password=None, role=None, __props__=None);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)- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
The following state arguments are supported:
- Cluster
Id string The ID of the original source database cluster.
- Mysql
Auth stringPlugin The authentication method to use for connections to the MySQL user account. The valid values are
mysql_native_passwordorcaching_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”.
- Cluster
Id string The ID of the original source database cluster.
- Mysql
Auth stringPlugin The authentication method to use for connections to the MySQL user account. The valid values are
mysql_native_passwordorcaching_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”.
- cluster
Id string The ID of the original source database cluster.
- mysql
Auth stringPlugin The authentication method to use for connections to the MySQL user account. The valid values are
mysql_native_passwordorcaching_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”.
- cluster_
id str The ID of the original source database cluster.
- mysql_
auth_ strplugin The authentication method to use for connections to the MySQL user account. The valid values are
mysql_native_passwordorcaching_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”.
Package Details
- Repository
- https://github.com/pulumi/pulumi-digitalocean
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
digitaloceanTerraform Provider.