1. Packages
  2. Vultr
  3. API Docs
  4. DatabaseUser
Vultr v2.23.1 published on Tuesday, Dec 10, 2024 by dirien

vultr.DatabaseUser

Explore with Pulumi AI

Provides a Vultr database user resource. This can be used to create, read, modify, and delete users for a managed database on your Vultr account.

Example Usage

Create a new database user:

import * as pulumi from "@pulumi/pulumi";
import * as vultr from "@ediri/vultr";

const myDatabaseUser = new vultr.DatabaseUser("myDatabaseUser", {
    databaseId: vultr_database.my_database.id,
    username: "my_database_user",
    password: "randomTestPW40298",
});
Copy
import pulumi
import ediri_vultr as vultr

my_database_user = vultr.DatabaseUser("myDatabaseUser",
    database_id=vultr_database["my_database"]["id"],
    username="my_database_user",
    password="randomTestPW40298")
Copy
package main

import (
	"github.com/dirien/pulumi-vultr/sdk/v2/go/vultr"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := vultr.NewDatabaseUser(ctx, "myDatabaseUser", &vultr.DatabaseUserArgs{
			DatabaseId: pulumi.Any(vultr_database.My_database.Id),
			Username:   pulumi.String("my_database_user"),
			Password:   pulumi.String("randomTestPW40298"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Vultr = ediri.Vultr;

return await Deployment.RunAsync(() => 
{
    var myDatabaseUser = new Vultr.DatabaseUser("myDatabaseUser", new()
    {
        DatabaseId = vultr_database.My_database.Id,
        Username = "my_database_user",
        Password = "randomTestPW40298",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.vultr.DatabaseUser;
import com.pulumi.vultr.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 myDatabaseUser = new DatabaseUser("myDatabaseUser", DatabaseUserArgs.builder()
            .databaseId(vultr_database.my_database().id())
            .username("my_database_user")
            .password("randomTestPW40298")
            .build());

    }
}
Copy
resources:
  myDatabaseUser:
    type: vultr:DatabaseUser
    properties:
      databaseId: ${vultr_database.my_database.id}
      username: my_database_user
      password: randomTestPW40298
Copy

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,
                 database_id: Optional[str] = None,
                 username: Optional[str] = None,
                 access_control: Optional[DatabaseUserAccessControlArgs] = None,
                 encryption: Optional[str] = None,
                 password: Optional[str] = None,
                 permission: Optional[str] = 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: vultr:DatabaseUser
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. DatabaseUserArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. 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 This property is required. string
The unique name of the resource.
args This property is required. DatabaseUserArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. DatabaseUserArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. 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 Vultr.DatabaseUser("databaseUserResource", new()
{
    DatabaseId = "string",
    Username = "string",
    AccessControl = new Vultr.Inputs.DatabaseUserAccessControlArgs
    {
        AclCategories = new[]
        {
            "string",
        },
        AclChannels = new[]
        {
            "string",
        },
        AclCommands = new[]
        {
            "string",
        },
        AclKeys = new[]
        {
            "string",
        },
    },
    Encryption = "string",
    Password = "string",
    Permission = "string",
});
Copy
example, err := vultr.NewDatabaseUser(ctx, "databaseUserResource", &vultr.DatabaseUserArgs{
	DatabaseId: pulumi.String("string"),
	Username:   pulumi.String("string"),
	AccessControl: &vultr.DatabaseUserAccessControlArgs{
		AclCategories: pulumi.StringArray{
			pulumi.String("string"),
		},
		AclChannels: pulumi.StringArray{
			pulumi.String("string"),
		},
		AclCommands: pulumi.StringArray{
			pulumi.String("string"),
		},
		AclKeys: pulumi.StringArray{
			pulumi.String("string"),
		},
	},
	Encryption: pulumi.String("string"),
	Password:   pulumi.String("string"),
	Permission: pulumi.String("string"),
})
Copy
var databaseUserResource = new DatabaseUser("databaseUserResource", DatabaseUserArgs.builder()
    .databaseId("string")
    .username("string")
    .accessControl(DatabaseUserAccessControlArgs.builder()
        .aclCategories("string")
        .aclChannels("string")
        .aclCommands("string")
        .aclKeys("string")
        .build())
    .encryption("string")
    .password("string")
    .permission("string")
    .build());
Copy
database_user_resource = vultr.DatabaseUser("databaseUserResource",
    database_id="string",
    username="string",
    access_control={
        "acl_categories": ["string"],
        "acl_channels": ["string"],
        "acl_commands": ["string"],
        "acl_keys": ["string"],
    },
    encryption="string",
    password="string",
    permission="string")
Copy
const databaseUserResource = new vultr.DatabaseUser("databaseUserResource", {
    databaseId: "string",
    username: "string",
    accessControl: {
        aclCategories: ["string"],
        aclChannels: ["string"],
        aclCommands: ["string"],
        aclKeys: ["string"],
    },
    encryption: "string",
    password: "string",
    permission: "string",
});
Copy
type: vultr:DatabaseUser
properties:
    accessControl:
        aclCategories:
            - string
        aclChannels:
            - string
        aclCommands:
            - string
        aclKeys:
            - string
    databaseId: string
    encryption: string
    password: string
    permission: string
    username: string
Copy

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:

DatabaseId
This property is required.
Changes to this property will trigger replacement.
string
The managed database ID you want to attach this user to.
Username This property is required. string
The username of the new managed database user.
AccessControl ediri.Vultr.Inputs.DatabaseUserAccessControl
Encryption string
The encryption type of the new managed database user's password (MySQL engine types only - caching_sha2_password, mysql_native_password).
Password string
The password of the new managed database user.
Permission string
The permission level for the database user (Kafka engine types only - admin, read, write, readwrite).
DatabaseId
This property is required.
Changes to this property will trigger replacement.
string
The managed database ID you want to attach this user to.
Username This property is required. string
The username of the new managed database user.
AccessControl DatabaseUserAccessControlArgs
Encryption string
The encryption type of the new managed database user's password (MySQL engine types only - caching_sha2_password, mysql_native_password).
Password string
The password of the new managed database user.
Permission string
The permission level for the database user (Kafka engine types only - admin, read, write, readwrite).
databaseId
This property is required.
Changes to this property will trigger replacement.
String
The managed database ID you want to attach this user to.
username This property is required. String
The username of the new managed database user.
accessControl DatabaseUserAccessControl
encryption String
The encryption type of the new managed database user's password (MySQL engine types only - caching_sha2_password, mysql_native_password).
password String
The password of the new managed database user.
permission String
The permission level for the database user (Kafka engine types only - admin, read, write, readwrite).
databaseId
This property is required.
Changes to this property will trigger replacement.
string
The managed database ID you want to attach this user to.
username This property is required. string
The username of the new managed database user.
accessControl DatabaseUserAccessControl
encryption string
The encryption type of the new managed database user's password (MySQL engine types only - caching_sha2_password, mysql_native_password).
password string
The password of the new managed database user.
permission string
The permission level for the database user (Kafka engine types only - admin, read, write, readwrite).
database_id
This property is required.
Changes to this property will trigger replacement.
str
The managed database ID you want to attach this user to.
username This property is required. str
The username of the new managed database user.
access_control DatabaseUserAccessControlArgs
encryption str
The encryption type of the new managed database user's password (MySQL engine types only - caching_sha2_password, mysql_native_password).
password str
The password of the new managed database user.
permission str
The permission level for the database user (Kafka engine types only - admin, read, write, readwrite).
databaseId
This property is required.
Changes to this property will trigger replacement.
String
The managed database ID you want to attach this user to.
username This property is required. String
The username of the new managed database user.
accessControl Property Map
encryption String
The encryption type of the new managed database user's password (MySQL engine types only - caching_sha2_password, mysql_native_password).
password String
The password of the new managed database user.
permission String
The permission level for the database user (Kafka engine types only - admin, read, write, readwrite).

Outputs

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

AccessCert string
AccessKey string
Id string
The provider-assigned unique ID for this managed resource.
AccessCert string
AccessKey string
Id string
The provider-assigned unique ID for this managed resource.
accessCert String
accessKey String
id String
The provider-assigned unique ID for this managed resource.
accessCert string
accessKey string
id string
The provider-assigned unique ID for this managed resource.
access_cert str
access_key str
id str
The provider-assigned unique ID for this managed resource.
accessCert String
accessKey String
id String
The provider-assigned unique ID for this managed resource.

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_control: Optional[DatabaseUserAccessControlArgs] = None,
        access_key: Optional[str] = None,
        database_id: Optional[str] = None,
        encryption: Optional[str] = None,
        password: Optional[str] = None,
        permission: Optional[str] = None,
        username: Optional[str] = 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)
resources:  _:    type: vultr:DatabaseUser    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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
AccessControl ediri.Vultr.Inputs.DatabaseUserAccessControl
AccessKey string
DatabaseId Changes to this property will trigger replacement. string
The managed database ID you want to attach this user to.
Encryption string
The encryption type of the new managed database user's password (MySQL engine types only - caching_sha2_password, mysql_native_password).
Password string
The password of the new managed database user.
Permission string
The permission level for the database user (Kafka engine types only - admin, read, write, readwrite).
Username string
The username of the new managed database user.
AccessCert string
AccessControl DatabaseUserAccessControlArgs
AccessKey string
DatabaseId Changes to this property will trigger replacement. string
The managed database ID you want to attach this user to.
Encryption string
The encryption type of the new managed database user's password (MySQL engine types only - caching_sha2_password, mysql_native_password).
Password string
The password of the new managed database user.
Permission string
The permission level for the database user (Kafka engine types only - admin, read, write, readwrite).
Username string
The username of the new managed database user.
accessCert String
accessControl DatabaseUserAccessControl
accessKey String
databaseId Changes to this property will trigger replacement. String
The managed database ID you want to attach this user to.
encryption String
The encryption type of the new managed database user's password (MySQL engine types only - caching_sha2_password, mysql_native_password).
password String
The password of the new managed database user.
permission String
The permission level for the database user (Kafka engine types only - admin, read, write, readwrite).
username String
The username of the new managed database user.
accessCert string
accessControl DatabaseUserAccessControl
accessKey string
databaseId Changes to this property will trigger replacement. string
The managed database ID you want to attach this user to.
encryption string
The encryption type of the new managed database user's password (MySQL engine types only - caching_sha2_password, mysql_native_password).
password string
The password of the new managed database user.
permission string
The permission level for the database user (Kafka engine types only - admin, read, write, readwrite).
username string
The username of the new managed database user.
access_cert str
access_control DatabaseUserAccessControlArgs
access_key str
database_id Changes to this property will trigger replacement. str
The managed database ID you want to attach this user to.
encryption str
The encryption type of the new managed database user's password (MySQL engine types only - caching_sha2_password, mysql_native_password).
password str
The password of the new managed database user.
permission str
The permission level for the database user (Kafka engine types only - admin, read, write, readwrite).
username str
The username of the new managed database user.
accessCert String
accessControl Property Map
accessKey String
databaseId Changes to this property will trigger replacement. String
The managed database ID you want to attach this user to.
encryption String
The encryption type of the new managed database user's password (MySQL engine types only - caching_sha2_password, mysql_native_password).
password String
The password of the new managed database user.
permission String
The permission level for the database user (Kafka engine types only - admin, read, write, readwrite).
username String
The username of the new managed database user.

Supporting Types

DatabaseUserAccessControl
, DatabaseUserAccessControlArgs

AclCategories This property is required. List<string>
List of command category rules for this managed database user (Redis engine types only).
AclChannels This property is required. List<string>
List of publish/subscribe channel patterns for this managed database user (Redis engine types only).
AclCommands This property is required. List<string>
List of individual command rules for this managed database user (Redis engine types only).
AclKeys This property is required. List<string>
List of access rules for this managed database user (Redis engine types only).
AclCategories This property is required. []string
List of command category rules for this managed database user (Redis engine types only).
AclChannels This property is required. []string
List of publish/subscribe channel patterns for this managed database user (Redis engine types only).
AclCommands This property is required. []string
List of individual command rules for this managed database user (Redis engine types only).
AclKeys This property is required. []string
List of access rules for this managed database user (Redis engine types only).
aclCategories This property is required. List<String>
List of command category rules for this managed database user (Redis engine types only).
aclChannels This property is required. List<String>
List of publish/subscribe channel patterns for this managed database user (Redis engine types only).
aclCommands This property is required. List<String>
List of individual command rules for this managed database user (Redis engine types only).
aclKeys This property is required. List<String>
List of access rules for this managed database user (Redis engine types only).
aclCategories This property is required. string[]
List of command category rules for this managed database user (Redis engine types only).
aclChannels This property is required. string[]
List of publish/subscribe channel patterns for this managed database user (Redis engine types only).
aclCommands This property is required. string[]
List of individual command rules for this managed database user (Redis engine types only).
aclKeys This property is required. string[]
List of access rules for this managed database user (Redis engine types only).
acl_categories This property is required. Sequence[str]
List of command category rules for this managed database user (Redis engine types only).
acl_channels This property is required. Sequence[str]
List of publish/subscribe channel patterns for this managed database user (Redis engine types only).
acl_commands This property is required. Sequence[str]
List of individual command rules for this managed database user (Redis engine types only).
acl_keys This property is required. Sequence[str]
List of access rules for this managed database user (Redis engine types only).
aclCategories This property is required. List<String>
List of command category rules for this managed database user (Redis engine types only).
aclChannels This property is required. List<String>
List of publish/subscribe channel patterns for this managed database user (Redis engine types only).
aclCommands This property is required. List<String>
List of individual command rules for this managed database user (Redis engine types only).
aclKeys This property is required. List<String>
List of access rules for this managed database user (Redis engine types only).

Package Details

Repository
vultr dirien/pulumi-vultr
License
Apache-2.0
Notes
This Pulumi package is based on the vultr Terraform Provider.