1. Packages
  2. Flexibleengine Provider
  3. API Docs
  4. RdsDatabasePrivilege
flexibleengine 1.46.0 published on Monday, Apr 14, 2025 by flexibleenginecloud

flexibleengine.RdsDatabasePrivilege

Explore with Pulumi AI

flexibleengine logo
flexibleengine 1.46.0 published on Monday, Apr 14, 2025 by flexibleenginecloud

    Manages RDS Mysql database privilege resource within FlexibleEngine.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as flexibleengine from "@pulumi/flexibleengine";
    
    const config = new pulumi.Config();
    const instanceId = config.requireObject("instanceId");
    const dbName = config.requireObject("dbName");
    const userName1 = config.requireObject("userName1");
    const userName2 = config.requireObject("userName2");
    const test = new flexibleengine.RdsDatabasePrivilege("test", {
        instanceId: instanceId,
        dbName: dbName,
        users: [
            {
                name: userName1,
                readonly: true,
            },
            {
                name: userName2,
                readonly: false,
            },
        ],
    });
    
    import pulumi
    import pulumi_flexibleengine as flexibleengine
    
    config = pulumi.Config()
    instance_id = config.require_object("instanceId")
    db_name = config.require_object("dbName")
    user_name1 = config.require_object("userName1")
    user_name2 = config.require_object("userName2")
    test = flexibleengine.RdsDatabasePrivilege("test",
        instance_id=instance_id,
        db_name=db_name,
        users=[
            {
                "name": user_name1,
                "readonly": True,
            },
            {
                "name": user_name2,
                "readonly": False,
            },
        ])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/flexibleengine/flexibleengine"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		cfg := config.New(ctx, "")
    		instanceId := cfg.RequireObject("instanceId")
    		dbName := cfg.RequireObject("dbName")
    		userName1 := cfg.RequireObject("userName1")
    		userName2 := cfg.RequireObject("userName2")
    		_, err := flexibleengine.NewRdsDatabasePrivilege(ctx, "test", &flexibleengine.RdsDatabasePrivilegeArgs{
    			InstanceId: pulumi.Any(instanceId),
    			DbName:     pulumi.Any(dbName),
    			Users: flexibleengine.RdsDatabasePrivilegeUserArray{
    				&flexibleengine.RdsDatabasePrivilegeUserArgs{
    					Name:     pulumi.Any(userName1),
    					Readonly: pulumi.Bool(true),
    				},
    				&flexibleengine.RdsDatabasePrivilegeUserArgs{
    					Name:     pulumi.Any(userName2),
    					Readonly: pulumi.Bool(false),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Flexibleengine = Pulumi.Flexibleengine;
    
    return await Deployment.RunAsync(() => 
    {
        var config = new Config();
        var instanceId = config.RequireObject<dynamic>("instanceId");
        var dbName = config.RequireObject<dynamic>("dbName");
        var userName1 = config.RequireObject<dynamic>("userName1");
        var userName2 = config.RequireObject<dynamic>("userName2");
        var test = new Flexibleengine.RdsDatabasePrivilege("test", new()
        {
            InstanceId = instanceId,
            DbName = dbName,
            Users = new[]
            {
                new Flexibleengine.Inputs.RdsDatabasePrivilegeUserArgs
                {
                    Name = userName1,
                    Readonly = true,
                },
                new Flexibleengine.Inputs.RdsDatabasePrivilegeUserArgs
                {
                    Name = userName2,
                    Readonly = false,
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.flexibleengine.RdsDatabasePrivilege;
    import com.pulumi.flexibleengine.RdsDatabasePrivilegeArgs;
    import com.pulumi.flexibleengine.inputs.RdsDatabasePrivilegeUserArgs;
    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) {
            final var config = ctx.config();
            final var instanceId = config.get("instanceId");
            final var dbName = config.get("dbName");
            final var userName1 = config.get("userName1");
            final var userName2 = config.get("userName2");
            var test = new RdsDatabasePrivilege("test", RdsDatabasePrivilegeArgs.builder()
                .instanceId(instanceId)
                .dbName(dbName)
                .users(            
                    RdsDatabasePrivilegeUserArgs.builder()
                        .name(userName1)
                        .readonly(true)
                        .build(),
                    RdsDatabasePrivilegeUserArgs.builder()
                        .name(userName2)
                        .readonly(false)
                        .build())
                .build());
    
        }
    }
    
    configuration:
      instanceId:
        type: dynamic
      dbName:
        type: dynamic
      userName1:
        type: dynamic
      userName2:
        type: dynamic
    resources:
      test:
        type: flexibleengine:RdsDatabasePrivilege
        properties:
          instanceId: ${instanceId}
          dbName: ${dbName}
          users:
            - name: ${userName1}
              readonly: true
            - name: ${userName2}
              readonly: false
    

    Create RdsDatabasePrivilege Resource

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

    Constructor syntax

    new RdsDatabasePrivilege(name: string, args: RdsDatabasePrivilegeArgs, opts?: CustomResourceOptions);
    @overload
    def RdsDatabasePrivilege(resource_name: str,
                             args: RdsDatabasePrivilegeArgs,
                             opts: Optional[ResourceOptions] = None)
    
    @overload
    def RdsDatabasePrivilege(resource_name: str,
                             opts: Optional[ResourceOptions] = None,
                             db_name: Optional[str] = None,
                             instance_id: Optional[str] = None,
                             users: Optional[Sequence[RdsDatabasePrivilegeUserArgs]] = None,
                             rds_database_privilege_id: Optional[str] = None,
                             region: Optional[str] = None,
                             timeouts: Optional[RdsDatabasePrivilegeTimeoutsArgs] = None)
    func NewRdsDatabasePrivilege(ctx *Context, name string, args RdsDatabasePrivilegeArgs, opts ...ResourceOption) (*RdsDatabasePrivilege, error)
    public RdsDatabasePrivilege(string name, RdsDatabasePrivilegeArgs args, CustomResourceOptions? opts = null)
    public RdsDatabasePrivilege(String name, RdsDatabasePrivilegeArgs args)
    public RdsDatabasePrivilege(String name, RdsDatabasePrivilegeArgs args, CustomResourceOptions options)
    
    type: flexibleengine:RdsDatabasePrivilege
    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 RdsDatabasePrivilegeArgs
    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 RdsDatabasePrivilegeArgs
    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 RdsDatabasePrivilegeArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args RdsDatabasePrivilegeArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args RdsDatabasePrivilegeArgs
    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 rdsDatabasePrivilegeResource = new Flexibleengine.RdsDatabasePrivilege("rdsDatabasePrivilegeResource", new()
    {
        DbName = "string",
        InstanceId = "string",
        Users = new[]
        {
            new Flexibleengine.Inputs.RdsDatabasePrivilegeUserArgs
            {
                Name = "string",
                Readonly = false,
            },
        },
        RdsDatabasePrivilegeId = "string",
        Region = "string",
        Timeouts = new Flexibleengine.Inputs.RdsDatabasePrivilegeTimeoutsArgs
        {
            Create = "string",
            Delete = "string",
            Update = "string",
        },
    });
    
    example, err := flexibleengine.NewRdsDatabasePrivilege(ctx, "rdsDatabasePrivilegeResource", &flexibleengine.RdsDatabasePrivilegeArgs{
    	DbName:     pulumi.String("string"),
    	InstanceId: pulumi.String("string"),
    	Users: flexibleengine.RdsDatabasePrivilegeUserArray{
    		&flexibleengine.RdsDatabasePrivilegeUserArgs{
    			Name:     pulumi.String("string"),
    			Readonly: pulumi.Bool(false),
    		},
    	},
    	RdsDatabasePrivilegeId: pulumi.String("string"),
    	Region:                 pulumi.String("string"),
    	Timeouts: &flexibleengine.RdsDatabasePrivilegeTimeoutsArgs{
    		Create: pulumi.String("string"),
    		Delete: pulumi.String("string"),
    		Update: pulumi.String("string"),
    	},
    })
    
    var rdsDatabasePrivilegeResource = new RdsDatabasePrivilege("rdsDatabasePrivilegeResource", RdsDatabasePrivilegeArgs.builder()
        .dbName("string")
        .instanceId("string")
        .users(RdsDatabasePrivilegeUserArgs.builder()
            .name("string")
            .readonly(false)
            .build())
        .rdsDatabasePrivilegeId("string")
        .region("string")
        .timeouts(RdsDatabasePrivilegeTimeoutsArgs.builder()
            .create("string")
            .delete("string")
            .update("string")
            .build())
        .build());
    
    rds_database_privilege_resource = flexibleengine.RdsDatabasePrivilege("rdsDatabasePrivilegeResource",
        db_name="string",
        instance_id="string",
        users=[{
            "name": "string",
            "readonly": False,
        }],
        rds_database_privilege_id="string",
        region="string",
        timeouts={
            "create": "string",
            "delete": "string",
            "update": "string",
        })
    
    const rdsDatabasePrivilegeResource = new flexibleengine.RdsDatabasePrivilege("rdsDatabasePrivilegeResource", {
        dbName: "string",
        instanceId: "string",
        users: [{
            name: "string",
            readonly: false,
        }],
        rdsDatabasePrivilegeId: "string",
        region: "string",
        timeouts: {
            create: "string",
            "delete": "string",
            update: "string",
        },
    });
    
    type: flexibleengine:RdsDatabasePrivilege
    properties:
        dbName: string
        instanceId: string
        rdsDatabasePrivilegeId: string
        region: string
        timeouts:
            create: string
            delete: string
            update: string
        users:
            - name: string
              readonly: false
    

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

    DbName string
    Specifies the database name. Changing this creates a new resource.
    InstanceId string
    Specifies the RDS instance ID. Changing this will create a new resource.
    Users List<RdsDatabasePrivilegeUser>

    Specifies the account that associated with the database. This parameter supports a maximum of 50 elements. The users object structure is documented below. Changing this creates a new resource.

    The users block supports:

    RdsDatabasePrivilegeId string
    The resource ID of database privilege which is formatted <instance_id>/<database_name>.
    Region string
    Specifies the region in which to create the RDS database privilege resource. If omitted, the provider-level region will be used. Changing this will create a new RDS database privilege resource.
    Timeouts RdsDatabasePrivilegeTimeouts
    DbName string
    Specifies the database name. Changing this creates a new resource.
    InstanceId string
    Specifies the RDS instance ID. Changing this will create a new resource.
    Users []RdsDatabasePrivilegeUserArgs

    Specifies the account that associated with the database. This parameter supports a maximum of 50 elements. The users object structure is documented below. Changing this creates a new resource.

    The users block supports:

    RdsDatabasePrivilegeId string
    The resource ID of database privilege which is formatted <instance_id>/<database_name>.
    Region string
    Specifies the region in which to create the RDS database privilege resource. If omitted, the provider-level region will be used. Changing this will create a new RDS database privilege resource.
    Timeouts RdsDatabasePrivilegeTimeoutsArgs
    dbName String
    Specifies the database name. Changing this creates a new resource.
    instanceId String
    Specifies the RDS instance ID. Changing this will create a new resource.
    users List<RdsDatabasePrivilegeUser>

    Specifies the account that associated with the database. This parameter supports a maximum of 50 elements. The users object structure is documented below. Changing this creates a new resource.

    The users block supports:

    rdsDatabasePrivilegeId String
    The resource ID of database privilege which is formatted <instance_id>/<database_name>.
    region String
    Specifies the region in which to create the RDS database privilege resource. If omitted, the provider-level region will be used. Changing this will create a new RDS database privilege resource.
    timeouts RdsDatabasePrivilegeTimeouts
    dbName string
    Specifies the database name. Changing this creates a new resource.
    instanceId string
    Specifies the RDS instance ID. Changing this will create a new resource.
    users RdsDatabasePrivilegeUser[]

    Specifies the account that associated with the database. This parameter supports a maximum of 50 elements. The users object structure is documented below. Changing this creates a new resource.

    The users block supports:

    rdsDatabasePrivilegeId string
    The resource ID of database privilege which is formatted <instance_id>/<database_name>.
    region string
    Specifies the region in which to create the RDS database privilege resource. If omitted, the provider-level region will be used. Changing this will create a new RDS database privilege resource.
    timeouts RdsDatabasePrivilegeTimeouts
    db_name str
    Specifies the database name. Changing this creates a new resource.
    instance_id str
    Specifies the RDS instance ID. Changing this will create a new resource.
    users Sequence[RdsDatabasePrivilegeUserArgs]

    Specifies the account that associated with the database. This parameter supports a maximum of 50 elements. The users object structure is documented below. Changing this creates a new resource.

    The users block supports:

    rds_database_privilege_id str
    The resource ID of database privilege which is formatted <instance_id>/<database_name>.
    region str
    Specifies the region in which to create the RDS database privilege resource. If omitted, the provider-level region will be used. Changing this will create a new RDS database privilege resource.
    timeouts RdsDatabasePrivilegeTimeoutsArgs
    dbName String
    Specifies the database name. Changing this creates a new resource.
    instanceId String
    Specifies the RDS instance ID. Changing this will create a new resource.
    users List<Property Map>

    Specifies the account that associated with the database. This parameter supports a maximum of 50 elements. The users object structure is documented below. Changing this creates a new resource.

    The users block supports:

    rdsDatabasePrivilegeId String
    The resource ID of database privilege which is formatted <instance_id>/<database_name>.
    region String
    Specifies the region in which to create the RDS database privilege resource. If omitted, the provider-level region will be used. Changing this will create a new RDS database privilege resource.
    timeouts Property Map

    Outputs

    All input properties are implicitly available as output properties. Additionally, the RdsDatabasePrivilege 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 RdsDatabasePrivilege Resource

    Get an existing RdsDatabasePrivilege 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?: RdsDatabasePrivilegeState, opts?: CustomResourceOptions): RdsDatabasePrivilege
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            db_name: Optional[str] = None,
            instance_id: Optional[str] = None,
            rds_database_privilege_id: Optional[str] = None,
            region: Optional[str] = None,
            timeouts: Optional[RdsDatabasePrivilegeTimeoutsArgs] = None,
            users: Optional[Sequence[RdsDatabasePrivilegeUserArgs]] = None) -> RdsDatabasePrivilege
    func GetRdsDatabasePrivilege(ctx *Context, name string, id IDInput, state *RdsDatabasePrivilegeState, opts ...ResourceOption) (*RdsDatabasePrivilege, error)
    public static RdsDatabasePrivilege Get(string name, Input<string> id, RdsDatabasePrivilegeState? state, CustomResourceOptions? opts = null)
    public static RdsDatabasePrivilege get(String name, Output<String> id, RdsDatabasePrivilegeState state, CustomResourceOptions options)
    resources:  _:    type: flexibleengine:RdsDatabasePrivilege    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:
    DbName string
    Specifies the database name. Changing this creates a new resource.
    InstanceId string
    Specifies the RDS instance ID. Changing this will create a new resource.
    RdsDatabasePrivilegeId string
    The resource ID of database privilege which is formatted <instance_id>/<database_name>.
    Region string
    Specifies the region in which to create the RDS database privilege resource. If omitted, the provider-level region will be used. Changing this will create a new RDS database privilege resource.
    Timeouts RdsDatabasePrivilegeTimeouts
    Users List<RdsDatabasePrivilegeUser>

    Specifies the account that associated with the database. This parameter supports a maximum of 50 elements. The users object structure is documented below. Changing this creates a new resource.

    The users block supports:

    DbName string
    Specifies the database name. Changing this creates a new resource.
    InstanceId string
    Specifies the RDS instance ID. Changing this will create a new resource.
    RdsDatabasePrivilegeId string
    The resource ID of database privilege which is formatted <instance_id>/<database_name>.
    Region string
    Specifies the region in which to create the RDS database privilege resource. If omitted, the provider-level region will be used. Changing this will create a new RDS database privilege resource.
    Timeouts RdsDatabasePrivilegeTimeoutsArgs
    Users []RdsDatabasePrivilegeUserArgs

    Specifies the account that associated with the database. This parameter supports a maximum of 50 elements. The users object structure is documented below. Changing this creates a new resource.

    The users block supports:

    dbName String
    Specifies the database name. Changing this creates a new resource.
    instanceId String
    Specifies the RDS instance ID. Changing this will create a new resource.
    rdsDatabasePrivilegeId String
    The resource ID of database privilege which is formatted <instance_id>/<database_name>.
    region String
    Specifies the region in which to create the RDS database privilege resource. If omitted, the provider-level region will be used. Changing this will create a new RDS database privilege resource.
    timeouts RdsDatabasePrivilegeTimeouts
    users List<RdsDatabasePrivilegeUser>

    Specifies the account that associated with the database. This parameter supports a maximum of 50 elements. The users object structure is documented below. Changing this creates a new resource.

    The users block supports:

    dbName string
    Specifies the database name. Changing this creates a new resource.
    instanceId string
    Specifies the RDS instance ID. Changing this will create a new resource.
    rdsDatabasePrivilegeId string
    The resource ID of database privilege which is formatted <instance_id>/<database_name>.
    region string
    Specifies the region in which to create the RDS database privilege resource. If omitted, the provider-level region will be used. Changing this will create a new RDS database privilege resource.
    timeouts RdsDatabasePrivilegeTimeouts
    users RdsDatabasePrivilegeUser[]

    Specifies the account that associated with the database. This parameter supports a maximum of 50 elements. The users object structure is documented below. Changing this creates a new resource.

    The users block supports:

    db_name str
    Specifies the database name. Changing this creates a new resource.
    instance_id str
    Specifies the RDS instance ID. Changing this will create a new resource.
    rds_database_privilege_id str
    The resource ID of database privilege which is formatted <instance_id>/<database_name>.
    region str
    Specifies the region in which to create the RDS database privilege resource. If omitted, the provider-level region will be used. Changing this will create a new RDS database privilege resource.
    timeouts RdsDatabasePrivilegeTimeoutsArgs
    users Sequence[RdsDatabasePrivilegeUserArgs]

    Specifies the account that associated with the database. This parameter supports a maximum of 50 elements. The users object structure is documented below. Changing this creates a new resource.

    The users block supports:

    dbName String
    Specifies the database name. Changing this creates a new resource.
    instanceId String
    Specifies the RDS instance ID. Changing this will create a new resource.
    rdsDatabasePrivilegeId String
    The resource ID of database privilege which is formatted <instance_id>/<database_name>.
    region String
    Specifies the region in which to create the RDS database privilege resource. If omitted, the provider-level region will be used. Changing this will create a new RDS database privilege resource.
    timeouts Property Map
    users List<Property Map>

    Specifies the account that associated with the database. This parameter supports a maximum of 50 elements. The users object structure is documented below. Changing this creates a new resource.

    The users block supports:

    Supporting Types

    RdsDatabasePrivilegeTimeouts, RdsDatabasePrivilegeTimeoutsArgs

    Create string
    Delete string
    Update string
    Create string
    Delete string
    Update string
    create String
    delete String
    update String
    create string
    delete string
    update string
    create str
    delete str
    update str
    create String
    delete String
    update String

    RdsDatabasePrivilegeUser, RdsDatabasePrivilegeUserArgs

    Name string
    Specifies the username of the database account.
    Readonly bool

    Specifies the read-only permission. The value can be:

    • true: indicates the read-only permission.
    • false: indicates the read and write permission.

    The default value is false.

    Name string
    Specifies the username of the database account.
    Readonly bool

    Specifies the read-only permission. The value can be:

    • true: indicates the read-only permission.
    • false: indicates the read and write permission.

    The default value is false.

    name String
    Specifies the username of the database account.
    readonly Boolean

    Specifies the read-only permission. The value can be:

    • true: indicates the read-only permission.
    • false: indicates the read and write permission.

    The default value is false.

    name string
    Specifies the username of the database account.
    readonly boolean

    Specifies the read-only permission. The value can be:

    • true: indicates the read-only permission.
    • false: indicates the read and write permission.

    The default value is false.

    name str
    Specifies the username of the database account.
    readonly bool

    Specifies the read-only permission. The value can be:

    • true: indicates the read-only permission.
    • false: indicates the read and write permission.

    The default value is false.

    name String
    Specifies the username of the database account.
    readonly Boolean

    Specifies the read-only permission. The value can be:

    • true: indicates the read-only permission.
    • false: indicates the read and write permission.

    The default value is false.

    Import

    RDS database privilege can be imported using the instance id and database name, e.g.

    $ pulumi import flexibleengine:index/rdsDatabasePrivilege:RdsDatabasePrivilege test instance_id/database_name
    

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

    Package Details

    Repository
    flexibleengine flexibleenginecloud/terraform-provider-flexibleengine
    License
    Notes
    This Pulumi package is based on the flexibleengine Terraform Provider.
    flexibleengine logo
    flexibleengine 1.46.0 published on Monday, Apr 14, 2025 by flexibleenginecloud