1. Packages
  2. Vkcs Provider
  3. API Docs
  4. DbUser
vkcs 0.9.3 published on Tuesday, Apr 15, 2025 by vk-cs

vkcs.DbUser

Explore with Pulumi AI

vkcs logo
vkcs 0.9.3 published on Tuesday, Apr 15, 2025 by vk-cs

    Provides a db user resource. This can be used to create, modify and delete db user.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as vkcs from "@pulumi/vkcs";
    
    const mysqlUser = new vkcs.DbUser("mysqlUser", {
        password: "Test_p@ssword-12-3",
        dbmsId: vkcs_db_instance.mysql.id,
        databases: [
            vkcs_db_database.mysql_db_1.name,
            vkcs_db_database.mysql_db_2.name,
        ],
    });
    
    import pulumi
    import pulumi_vkcs as vkcs
    
    mysql_user = vkcs.DbUser("mysqlUser",
        password="Test_p@ssword-12-3",
        dbms_id=vkcs_db_instance["mysql"]["id"],
        databases=[
            vkcs_db_database["mysql_db_1"]["name"],
            vkcs_db_database["mysql_db_2"]["name"],
        ])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/vkcs/vkcs"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := vkcs.NewDbUser(ctx, "mysqlUser", &vkcs.DbUserArgs{
    			Password: pulumi.String("Test_p@ssword-12-3"),
    			DbmsId:   pulumi.Any(vkcs_db_instance.Mysql.Id),
    			Databases: pulumi.StringArray{
    				vkcs_db_database.Mysql_db_1.Name,
    				vkcs_db_database.Mysql_db_2.Name,
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Vkcs = Pulumi.Vkcs;
    
    return await Deployment.RunAsync(() => 
    {
        var mysqlUser = new Vkcs.DbUser("mysqlUser", new()
        {
            Password = "Test_p@ssword-12-3",
            DbmsId = vkcs_db_instance.Mysql.Id,
            Databases = new[]
            {
                vkcs_db_database.Mysql_db_1.Name,
                vkcs_db_database.Mysql_db_2.Name,
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.vkcs.DbUser;
    import com.pulumi.vkcs.DbUserArgs;
    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 mysqlUser = new DbUser("mysqlUser", DbUserArgs.builder()
                .password("Test_p@ssword-12-3")
                .dbmsId(vkcs_db_instance.mysql().id())
                .databases(            
                    vkcs_db_database.mysql_db_1().name(),
                    vkcs_db_database.mysql_db_2().name())
                .build());
    
        }
    }
    
    resources:
      mysqlUser:
        type: vkcs:DbUser
        properties:
          password: Test_p@ssword-12-3
          dbmsId: ${vkcs_db_instance.mysql.id}
          databases:
            - ${vkcs_db_database.mysql_db_1.name}
            - ${vkcs_db_database.mysql_db_2.name}
    

    Create DbUser Resource

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

    Constructor syntax

    new DbUser(name: string, args: DbUserArgs, opts?: CustomResourceOptions);
    @overload
    def DbUser(resource_name: str,
               args: DbUserArgs,
               opts: Optional[ResourceOptions] = None)
    
    @overload
    def DbUser(resource_name: str,
               opts: Optional[ResourceOptions] = None,
               dbms_id: Optional[str] = None,
               password: Optional[str] = None,
               databases: Optional[Sequence[str]] = None,
               db_user_id: Optional[str] = None,
               host: Optional[str] = None,
               name: Optional[str] = None,
               timeouts: Optional[DbUserTimeoutsArgs] = None,
               vendor_options: Optional[DbUserVendorOptionsArgs] = None)
    func NewDbUser(ctx *Context, name string, args DbUserArgs, opts ...ResourceOption) (*DbUser, error)
    public DbUser(string name, DbUserArgs args, CustomResourceOptions? opts = null)
    public DbUser(String name, DbUserArgs args)
    public DbUser(String name, DbUserArgs args, CustomResourceOptions options)
    
    type: vkcs:DbUser
    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 DbUserArgs
    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 DbUserArgs
    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 DbUserArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args DbUserArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args DbUserArgs
    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 dbUserResource = new Vkcs.DbUser("dbUserResource", new()
    {
        DbmsId = "string",
        Password = "string",
        Databases = new[]
        {
            "string",
        },
        DbUserId = "string",
        Host = "string",
        Name = "string",
        Timeouts = new Vkcs.Inputs.DbUserTimeoutsArgs
        {
            Create = "string",
            Delete = "string",
        },
        VendorOptions = new Vkcs.Inputs.DbUserVendorOptionsArgs
        {
            SkipDeletion = false,
        },
    });
    
    example, err := vkcs.NewDbUser(ctx, "dbUserResource", &vkcs.DbUserArgs{
    DbmsId: pulumi.String("string"),
    Password: pulumi.String("string"),
    Databases: pulumi.StringArray{
    pulumi.String("string"),
    },
    DbUserId: pulumi.String("string"),
    Host: pulumi.String("string"),
    Name: pulumi.String("string"),
    Timeouts: &.DbUserTimeoutsArgs{
    Create: pulumi.String("string"),
    Delete: pulumi.String("string"),
    },
    VendorOptions: &.DbUserVendorOptionsArgs{
    SkipDeletion: pulumi.Bool(false),
    },
    })
    
    var dbUserResource = new DbUser("dbUserResource", DbUserArgs.builder()
        .dbmsId("string")
        .password("string")
        .databases("string")
        .dbUserId("string")
        .host("string")
        .name("string")
        .timeouts(DbUserTimeoutsArgs.builder()
            .create("string")
            .delete("string")
            .build())
        .vendorOptions(DbUserVendorOptionsArgs.builder()
            .skipDeletion(false)
            .build())
        .build());
    
    db_user_resource = vkcs.DbUser("dbUserResource",
        dbms_id="string",
        password="string",
        databases=["string"],
        db_user_id="string",
        host="string",
        name="string",
        timeouts={
            "create": "string",
            "delete": "string",
        },
        vendor_options={
            "skip_deletion": False,
        })
    
    const dbUserResource = new vkcs.DbUser("dbUserResource", {
        dbmsId: "string",
        password: "string",
        databases: ["string"],
        dbUserId: "string",
        host: "string",
        name: "string",
        timeouts: {
            create: "string",
            "delete": "string",
        },
        vendorOptions: {
            skipDeletion: false,
        },
    });
    
    type: vkcs:DbUser
    properties:
        databases:
            - string
        dbUserId: string
        dbmsId: string
        host: string
        name: string
        password: string
        timeouts:
            create: string
            delete: string
        vendorOptions:
            skipDeletion: false
    

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

    DbmsId string
    required string → ID of the instance or cluster that user is created for.
    Password string
    required sensitive string → The password of the user.
    Databases List<string>
    optional set of string → List of names of the databases, that user is created for.
    DbUserId string
    string → ID of the resource.
    Host string
    optional string → IP address of the host that user will be accessible from.
    Name string
    required string → The name of the user. Changing this creates a new user.
    Timeouts DbUserTimeouts
    VendorOptions DbUserVendorOptions
    optional → New since v0.5.3.
    DbmsId string
    required string → ID of the instance or cluster that user is created for.
    Password string
    required sensitive string → The password of the user.
    Databases []string
    optional set of string → List of names of the databases, that user is created for.
    DbUserId string
    string → ID of the resource.
    Host string
    optional string → IP address of the host that user will be accessible from.
    Name string
    required string → The name of the user. Changing this creates a new user.
    Timeouts DbUserTimeoutsArgs
    VendorOptions DbUserVendorOptionsArgs
    optional → New since v0.5.3.
    dbmsId String
    required string → ID of the instance or cluster that user is created for.
    password String
    required sensitive string → The password of the user.
    databases List<String>
    optional set of string → List of names of the databases, that user is created for.
    dbUserId String
    string → ID of the resource.
    host String
    optional string → IP address of the host that user will be accessible from.
    name String
    required string → The name of the user. Changing this creates a new user.
    timeouts DbUserTimeouts
    vendorOptions DbUserVendorOptions
    optional → New since v0.5.3.
    dbmsId string
    required string → ID of the instance or cluster that user is created for.
    password string
    required sensitive string → The password of the user.
    databases string[]
    optional set of string → List of names of the databases, that user is created for.
    dbUserId string
    string → ID of the resource.
    host string
    optional string → IP address of the host that user will be accessible from.
    name string
    required string → The name of the user. Changing this creates a new user.
    timeouts DbUserTimeouts
    vendorOptions DbUserVendorOptions
    optional → New since v0.5.3.
    dbms_id str
    required string → ID of the instance or cluster that user is created for.
    password str
    required sensitive string → The password of the user.
    databases Sequence[str]
    optional set of string → List of names of the databases, that user is created for.
    db_user_id str
    string → ID of the resource.
    host str
    optional string → IP address of the host that user will be accessible from.
    name str
    required string → The name of the user. Changing this creates a new user.
    timeouts DbUserTimeoutsArgs
    vendor_options DbUserVendorOptionsArgs
    optional → New since v0.5.3.
    dbmsId String
    required string → ID of the instance or cluster that user is created for.
    password String
    required sensitive string → The password of the user.
    databases List<String>
    optional set of string → List of names of the databases, that user is created for.
    dbUserId String
    string → ID of the resource.
    host String
    optional string → IP address of the host that user will be accessible from.
    name String
    required string → The name of the user. Changing this creates a new user.
    timeouts Property Map
    vendorOptions Property Map
    optional → New since v0.5.3.

    Outputs

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

    DbmsType string
    string → Type of dbms for the user, can be "instance" or "cluster".
    Id string
    The provider-assigned unique ID for this managed resource.
    DbmsType string
    string → Type of dbms for the user, can be "instance" or "cluster".
    Id string
    The provider-assigned unique ID for this managed resource.
    dbmsType String
    string → Type of dbms for the user, can be "instance" or "cluster".
    id String
    The provider-assigned unique ID for this managed resource.
    dbmsType string
    string → Type of dbms for the user, can be "instance" or "cluster".
    id string
    The provider-assigned unique ID for this managed resource.
    dbms_type str
    string → Type of dbms for the user, can be "instance" or "cluster".
    id str
    The provider-assigned unique ID for this managed resource.
    dbmsType String
    string → Type of dbms for the user, can be "instance" or "cluster".
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing DbUser Resource

    Get an existing DbUser 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?: DbUserState, opts?: CustomResourceOptions): DbUser
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            databases: Optional[Sequence[str]] = None,
            db_user_id: Optional[str] = None,
            dbms_id: Optional[str] = None,
            dbms_type: Optional[str] = None,
            host: Optional[str] = None,
            name: Optional[str] = None,
            password: Optional[str] = None,
            timeouts: Optional[DbUserTimeoutsArgs] = None,
            vendor_options: Optional[DbUserVendorOptionsArgs] = None) -> DbUser
    func GetDbUser(ctx *Context, name string, id IDInput, state *DbUserState, opts ...ResourceOption) (*DbUser, error)
    public static DbUser Get(string name, Input<string> id, DbUserState? state, CustomResourceOptions? opts = null)
    public static DbUser get(String name, Output<String> id, DbUserState state, CustomResourceOptions options)
    resources:  _:    type: vkcs:DbUser    get:      id: ${id}
    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:
    Databases List<string>
    optional set of string → List of names of the databases, that user is created for.
    DbUserId string
    string → ID of the resource.
    DbmsId string
    required string → ID of the instance or cluster that user is created for.
    DbmsType string
    string → Type of dbms for the user, can be "instance" or "cluster".
    Host string
    optional string → IP address of the host that user will be accessible from.
    Name string
    required string → The name of the user. Changing this creates a new user.
    Password string
    required sensitive string → The password of the user.
    Timeouts DbUserTimeouts
    VendorOptions DbUserVendorOptions
    optional → New since v0.5.3.
    Databases []string
    optional set of string → List of names of the databases, that user is created for.
    DbUserId string
    string → ID of the resource.
    DbmsId string
    required string → ID of the instance or cluster that user is created for.
    DbmsType string
    string → Type of dbms for the user, can be "instance" or "cluster".
    Host string
    optional string → IP address of the host that user will be accessible from.
    Name string
    required string → The name of the user. Changing this creates a new user.
    Password string
    required sensitive string → The password of the user.
    Timeouts DbUserTimeoutsArgs
    VendorOptions DbUserVendorOptionsArgs
    optional → New since v0.5.3.
    databases List<String>
    optional set of string → List of names of the databases, that user is created for.
    dbUserId String
    string → ID of the resource.
    dbmsId String
    required string → ID of the instance or cluster that user is created for.
    dbmsType String
    string → Type of dbms for the user, can be "instance" or "cluster".
    host String
    optional string → IP address of the host that user will be accessible from.
    name String
    required string → The name of the user. Changing this creates a new user.
    password String
    required sensitive string → The password of the user.
    timeouts DbUserTimeouts
    vendorOptions DbUserVendorOptions
    optional → New since v0.5.3.
    databases string[]
    optional set of string → List of names of the databases, that user is created for.
    dbUserId string
    string → ID of the resource.
    dbmsId string
    required string → ID of the instance or cluster that user is created for.
    dbmsType string
    string → Type of dbms for the user, can be "instance" or "cluster".
    host string
    optional string → IP address of the host that user will be accessible from.
    name string
    required string → The name of the user. Changing this creates a new user.
    password string
    required sensitive string → The password of the user.
    timeouts DbUserTimeouts
    vendorOptions DbUserVendorOptions
    optional → New since v0.5.3.
    databases Sequence[str]
    optional set of string → List of names of the databases, that user is created for.
    db_user_id str
    string → ID of the resource.
    dbms_id str
    required string → ID of the instance or cluster that user is created for.
    dbms_type str
    string → Type of dbms for the user, can be "instance" or "cluster".
    host str
    optional string → IP address of the host that user will be accessible from.
    name str
    required string → The name of the user. Changing this creates a new user.
    password str
    required sensitive string → The password of the user.
    timeouts DbUserTimeoutsArgs
    vendor_options DbUserVendorOptionsArgs
    optional → New since v0.5.3.
    databases List<String>
    optional set of string → List of names of the databases, that user is created for.
    dbUserId String
    string → ID of the resource.
    dbmsId String
    required string → ID of the instance or cluster that user is created for.
    dbmsType String
    string → Type of dbms for the user, can be "instance" or "cluster".
    host String
    optional string → IP address of the host that user will be accessible from.
    name String
    required string → The name of the user. Changing this creates a new user.
    password String
    required sensitive string → The password of the user.
    timeouts Property Map
    vendorOptions Property Map
    optional → New since v0.5.3.

    Supporting Types

    DbUserTimeouts, DbUserTimeoutsArgs

    Create string
    Delete string
    Create string
    Delete string
    create String
    delete String
    create string
    delete string
    create str
    delete str
    create String
    delete String

    DbUserVendorOptions, DbUserVendorOptionsArgs

    SkipDeletion bool
    optional boolean → Boolean to control whether to user deletion should be skipped. If set to true, the resource will be removed from the state, but the remote object will not be deleted. This is useful for PostgreSQL, where users cannot be deleted from the API if they own database objects.
    SkipDeletion bool
    optional boolean → Boolean to control whether to user deletion should be skipped. If set to true, the resource will be removed from the state, but the remote object will not be deleted. This is useful for PostgreSQL, where users cannot be deleted from the API if they own database objects.
    skipDeletion Boolean
    optional boolean → Boolean to control whether to user deletion should be skipped. If set to true, the resource will be removed from the state, but the remote object will not be deleted. This is useful for PostgreSQL, where users cannot be deleted from the API if they own database objects.
    skipDeletion boolean
    optional boolean → Boolean to control whether to user deletion should be skipped. If set to true, the resource will be removed from the state, but the remote object will not be deleted. This is useful for PostgreSQL, where users cannot be deleted from the API if they own database objects.
    skip_deletion bool
    optional boolean → Boolean to control whether to user deletion should be skipped. If set to true, the resource will be removed from the state, but the remote object will not be deleted. This is useful for PostgreSQL, where users cannot be deleted from the API if they own database objects.
    skipDeletion Boolean
    optional boolean → Boolean to control whether to user deletion should be skipped. If set to true, the resource will be removed from the state, but the remote object will not be deleted. This is useful for PostgreSQL, where users cannot be deleted from the API if they own database objects.

    Import

    Users can be imported using the dbms_id/name

    $ pulumi import vkcs:index/dbUser:DbUser myuser b29f9249-b0e0-43f2-9278-34ed8284a4dc/myusername
    

    After the import you can use terraform show to view imported fields and write their values to your .tf file.

    You should at least add following fields to your .tf file:

    name, dbms_id, password

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

    Package Details

    Repository
    vkcs vk-cs/terraform-provider-vkcs
    License
    Notes
    This Pulumi package is based on the vkcs Terraform Provider.
    vkcs logo
    vkcs 0.9.3 published on Tuesday, Apr 15, 2025 by vk-cs