1. Packages
  2. Vultr
  3. API Docs
  4. DatabaseUser
Vultr v2.21.1 published on Monday, Jul 22, 2024 by dirien

vultr.DatabaseUser

Explore with Pulumi AI

vultr logo
Vultr v2.21.1 published on Monday, Jul 22, 2024 by dirien

    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",
    });
    
    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")
    
    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
    	})
    }
    
    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",
        });
    
    });
    
    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());
    
        }
    }
    
    resources:
      myDatabaseUser:
        type: vultr:DatabaseUser
        properties:
          databaseId: ${vultr_database.my_database.id}
          username: my_database_user
          password: randomTestPW40298
    

    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)
    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 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 Vultr.DatabaseUser("databaseUserResource", new()
    {
        DatabaseId = "string",
        Username = "string",
        AccessControl = new Vultr.Inputs.DatabaseUserAccessControlArgs
        {
            RedisAclCategories = new[]
            {
                "string",
            },
            RedisAclChannels = new[]
            {
                "string",
            },
            RedisAclCommands = new[]
            {
                "string",
            },
            RedisAclKeys = new[]
            {
                "string",
            },
        },
        Encryption = "string",
        Password = "string",
    });
    
    example, err := vultr.NewDatabaseUser(ctx, "databaseUserResource", &vultr.DatabaseUserArgs{
    	DatabaseId: pulumi.String("string"),
    	Username:   pulumi.String("string"),
    	AccessControl: &vultr.DatabaseUserAccessControlArgs{
    		RedisAclCategories: pulumi.StringArray{
    			pulumi.String("string"),
    		},
    		RedisAclChannels: pulumi.StringArray{
    			pulumi.String("string"),
    		},
    		RedisAclCommands: pulumi.StringArray{
    			pulumi.String("string"),
    		},
    		RedisAclKeys: pulumi.StringArray{
    			pulumi.String("string"),
    		},
    	},
    	Encryption: pulumi.String("string"),
    	Password:   pulumi.String("string"),
    })
    
    var databaseUserResource = new DatabaseUser("databaseUserResource", DatabaseUserArgs.builder()
        .databaseId("string")
        .username("string")
        .accessControl(DatabaseUserAccessControlArgs.builder()
            .redisAclCategories("string")
            .redisAclChannels("string")
            .redisAclCommands("string")
            .redisAclKeys("string")
            .build())
        .encryption("string")
        .password("string")
        .build());
    
    database_user_resource = vultr.DatabaseUser("databaseUserResource",
        database_id="string",
        username="string",
        access_control=vultr.DatabaseUserAccessControlArgs(
            redis_acl_categories=["string"],
            redis_acl_channels=["string"],
            redis_acl_commands=["string"],
            redis_acl_keys=["string"],
        ),
        encryption="string",
        password="string")
    
    const databaseUserResource = new vultr.DatabaseUser("databaseUserResource", {
        databaseId: "string",
        username: "string",
        accessControl: {
            redisAclCategories: ["string"],
            redisAclChannels: ["string"],
            redisAclCommands: ["string"],
            redisAclKeys: ["string"],
        },
        encryption: "string",
        password: "string",
    });
    
    type: vultr:DatabaseUser
    properties:
        accessControl:
            redisAclCategories:
                - string
            redisAclChannels:
                - string
            redisAclCommands:
                - string
            redisAclKeys:
                - string
        databaseId: string
        encryption: string
        password: string
        username: 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

    The DatabaseUser resource accepts the following input properties:

    DatabaseId string
    The managed database ID you want to attach this user to.
    Username 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.
    DatabaseId string
    The managed database ID you want to attach this user to.
    Username 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.
    databaseId String
    The managed database ID you want to attach this user to.
    username 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.
    databaseId string
    The managed database ID you want to attach this user to.
    username 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.
    database_id str
    The managed database ID you want to attach this user to.
    username 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.
    databaseId String
    The managed database ID you want to attach this user to.
    username 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.

    Outputs

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

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    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_control: Optional[DatabaseUserAccessControlArgs] = None,
            database_id: Optional[str] = None,
            encryption: Optional[str] = None,
            password: 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)
    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:
    AccessControl ediri.Vultr.Inputs.DatabaseUserAccessControl
    DatabaseId 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.
    Username string
    The username of the new managed database user.
    AccessControl DatabaseUserAccessControlArgs
    DatabaseId 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.
    Username string
    The username of the new managed database user.
    accessControl DatabaseUserAccessControl
    databaseId 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.
    username String
    The username of the new managed database user.
    accessControl DatabaseUserAccessControl
    databaseId 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.
    username string
    The username of the new managed database user.
    access_control DatabaseUserAccessControlArgs
    database_id 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.
    username str
    The username of the new managed database user.
    accessControl Property Map
    databaseId 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.
    username String
    The username of the new managed database user.

    Supporting Types

    DatabaseUserAccessControl, DatabaseUserAccessControlArgs

    RedisAclCategories List<string>
    The list of command category rules for this managed database user.
    RedisAclChannels List<string>
    The list of publish/subscribe channel patterns for this managed database user.
    RedisAclCommands List<string>
    The list of individual command rules for this managed database user.
    RedisAclKeys List<string>
    The list of access rules for this managed database user.
    RedisAclCategories []string
    The list of command category rules for this managed database user.
    RedisAclChannels []string
    The list of publish/subscribe channel patterns for this managed database user.
    RedisAclCommands []string
    The list of individual command rules for this managed database user.
    RedisAclKeys []string
    The list of access rules for this managed database user.
    redisAclCategories List<String>
    The list of command category rules for this managed database user.
    redisAclChannels List<String>
    The list of publish/subscribe channel patterns for this managed database user.
    redisAclCommands List<String>
    The list of individual command rules for this managed database user.
    redisAclKeys List<String>
    The list of access rules for this managed database user.
    redisAclCategories string[]
    The list of command category rules for this managed database user.
    redisAclChannels string[]
    The list of publish/subscribe channel patterns for this managed database user.
    redisAclCommands string[]
    The list of individual command rules for this managed database user.
    redisAclKeys string[]
    The list of access rules for this managed database user.
    redis_acl_categories Sequence[str]
    The list of command category rules for this managed database user.
    redis_acl_channels Sequence[str]
    The list of publish/subscribe channel patterns for this managed database user.
    redis_acl_commands Sequence[str]
    The list of individual command rules for this managed database user.
    redis_acl_keys Sequence[str]
    The list of access rules for this managed database user.
    redisAclCategories List<String>
    The list of command category rules for this managed database user.
    redisAclChannels List<String>
    The list of publish/subscribe channel patterns for this managed database user.
    redisAclCommands List<String>
    The list of individual command rules for this managed database user.
    redisAclKeys List<String>
    The list of access rules for this managed database user.

    Package Details

    Repository
    vultr dirien/pulumi-vultr
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the vultr Terraform Provider.
    vultr logo
    Vultr v2.21.1 published on Monday, Jul 22, 2024 by dirien