1. Packages
  2. Volcengine
  3. API Docs
  4. rds
  5. AccountPrivilege
Volcengine v0.0.27 published on Tuesday, Dec 10, 2024 by Volcengine

volcengine.rds.AccountPrivilege

Explore with Pulumi AI

(Deprecated! Recommend use volcengine_rds_mysql_*** replace) Provides a resource to manage rds account privilege

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as volcengine from "@volcengine/pulumi";

const appName = new volcengine.rds.Account("appName", {
    instanceId: "mysql-0fdd3bab2e7c",
    accountName: "terraform-test-app",
    accountPassword: "Aatest123",
    accountType: "Normal",
});
const foo = new volcengine.rds.AccountPrivilege("foo", {
    instanceId: "mysql-0fdd3bab2e7c",
    accountName: appName.accountName,
    dbPrivileges: [
        {
            dbName: "foo",
            accountPrivilege: "Custom",
            accountPrivilegeStr: "ALTER,ALTER ROUTINE,CREATE,CREATE ROUTINE,CREATE TEMPORARY TABLES",
        },
        {
            dbName: "bar",
            accountPrivilege: "DDLOnly",
        },
        {
            dbName: "demo",
            accountPrivilege: "ReadWrite",
        },
    ],
});
Copy
import pulumi
import pulumi_volcengine as volcengine

app_name = volcengine.rds.Account("appName",
    instance_id="mysql-0fdd3bab2e7c",
    account_name="terraform-test-app",
    account_password="Aatest123",
    account_type="Normal")
foo = volcengine.rds.AccountPrivilege("foo",
    instance_id="mysql-0fdd3bab2e7c",
    account_name=app_name.account_name,
    db_privileges=[
        volcengine.rds.AccountPrivilegeDbPrivilegeArgs(
            db_name="foo",
            account_privilege="Custom",
            account_privilege_str="ALTER,ALTER ROUTINE,CREATE,CREATE ROUTINE,CREATE TEMPORARY TABLES",
        ),
        volcengine.rds.AccountPrivilegeDbPrivilegeArgs(
            db_name="bar",
            account_privilege="DDLOnly",
        ),
        volcengine.rds.AccountPrivilegeDbPrivilegeArgs(
            db_name="demo",
            account_privilege="ReadWrite",
        ),
    ])
Copy
package main

import (
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
	"github.com/volcengine/pulumi-volcengine/sdk/go/volcengine/rds"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		appName, err := rds.NewAccount(ctx, "appName", &rds.AccountArgs{
			InstanceId:      pulumi.String("mysql-0fdd3bab2e7c"),
			AccountName:     pulumi.String("terraform-test-app"),
			AccountPassword: pulumi.String("Aatest123"),
			AccountType:     pulumi.String("Normal"),
		})
		if err != nil {
			return err
		}
		_, err = rds.NewAccountPrivilege(ctx, "foo", &rds.AccountPrivilegeArgs{
			InstanceId:  pulumi.String("mysql-0fdd3bab2e7c"),
			AccountName: appName.AccountName,
			DbPrivileges: rds.AccountPrivilegeDbPrivilegeArray{
				&rds.AccountPrivilegeDbPrivilegeArgs{
					DbName:              pulumi.String("foo"),
					AccountPrivilege:    pulumi.String("Custom"),
					AccountPrivilegeStr: pulumi.String("ALTER,ALTER ROUTINE,CREATE,CREATE ROUTINE,CREATE TEMPORARY TABLES"),
				},
				&rds.AccountPrivilegeDbPrivilegeArgs{
					DbName:           pulumi.String("bar"),
					AccountPrivilege: pulumi.String("DDLOnly"),
				},
				&rds.AccountPrivilegeDbPrivilegeArgs{
					DbName:           pulumi.String("demo"),
					AccountPrivilege: pulumi.String("ReadWrite"),
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Volcengine = Pulumi.Volcengine;

return await Deployment.RunAsync(() => 
{
    var appName = new Volcengine.Rds.Account("appName", new()
    {
        InstanceId = "mysql-0fdd3bab2e7c",
        AccountName = "terraform-test-app",
        AccountPassword = "Aatest123",
        AccountType = "Normal",
    });

    var foo = new Volcengine.Rds.AccountPrivilege("foo", new()
    {
        InstanceId = "mysql-0fdd3bab2e7c",
        AccountName = appName.AccountName,
        DbPrivileges = new[]
        {
            new Volcengine.Rds.Inputs.AccountPrivilegeDbPrivilegeArgs
            {
                DbName = "foo",
                AccountPrivilege = "Custom",
                AccountPrivilegeStr = "ALTER,ALTER ROUTINE,CREATE,CREATE ROUTINE,CREATE TEMPORARY TABLES",
            },
            new Volcengine.Rds.Inputs.AccountPrivilegeDbPrivilegeArgs
            {
                DbName = "bar",
                AccountPrivilege = "DDLOnly",
            },
            new Volcengine.Rds.Inputs.AccountPrivilegeDbPrivilegeArgs
            {
                DbName = "demo",
                AccountPrivilege = "ReadWrite",
            },
        },
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.volcengine.rds.Account;
import com.pulumi.volcengine.rds.AccountArgs;
import com.pulumi.volcengine.rds.AccountPrivilege;
import com.pulumi.volcengine.rds.AccountPrivilegeArgs;
import com.pulumi.volcengine.rds.inputs.AccountPrivilegeDbPrivilegeArgs;
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 appName = new Account("appName", AccountArgs.builder()        
            .instanceId("mysql-0fdd3bab2e7c")
            .accountName("terraform-test-app")
            .accountPassword("Aatest123")
            .accountType("Normal")
            .build());

        var foo = new AccountPrivilege("foo", AccountPrivilegeArgs.builder()        
            .instanceId("mysql-0fdd3bab2e7c")
            .accountName(appName.accountName())
            .dbPrivileges(            
                AccountPrivilegeDbPrivilegeArgs.builder()
                    .dbName("foo")
                    .accountPrivilege("Custom")
                    .accountPrivilegeStr("ALTER,ALTER ROUTINE,CREATE,CREATE ROUTINE,CREATE TEMPORARY TABLES")
                    .build(),
                AccountPrivilegeDbPrivilegeArgs.builder()
                    .dbName("bar")
                    .accountPrivilege("DDLOnly")
                    .build(),
                AccountPrivilegeDbPrivilegeArgs.builder()
                    .dbName("demo")
                    .accountPrivilege("ReadWrite")
                    .build())
            .build());

    }
}
Copy
resources:
  appName:
    type: volcengine:rds:Account
    properties:
      instanceId: mysql-0fdd3bab2e7c
      accountName: terraform-test-app
      accountPassword: Aatest123
      accountType: Normal
  foo:
    type: volcengine:rds:AccountPrivilege
    properties:
      instanceId: mysql-0fdd3bab2e7c
      accountName: ${appName.accountName}
      dbPrivileges:
        - dbName: foo
          accountPrivilege: Custom
          accountPrivilegeStr: ALTER,ALTER ROUTINE,CREATE,CREATE ROUTINE,CREATE TEMPORARY TABLES
        - dbName: bar
          accountPrivilege: DDLOnly
        - dbName: demo
          accountPrivilege: ReadWrite
Copy

Create AccountPrivilege Resource

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

Constructor syntax

new AccountPrivilege(name: string, args: AccountPrivilegeArgs, opts?: CustomResourceOptions);
@overload
def AccountPrivilege(resource_name: str,
                     args: AccountPrivilegeArgs,
                     opts: Optional[ResourceOptions] = None)

@overload
def AccountPrivilege(resource_name: str,
                     opts: Optional[ResourceOptions] = None,
                     account_name: Optional[str] = None,
                     db_privileges: Optional[Sequence[AccountPrivilegeDbPrivilegeArgs]] = None,
                     instance_id: Optional[str] = None)
func NewAccountPrivilege(ctx *Context, name string, args AccountPrivilegeArgs, opts ...ResourceOption) (*AccountPrivilege, error)
public AccountPrivilege(string name, AccountPrivilegeArgs args, CustomResourceOptions? opts = null)
public AccountPrivilege(String name, AccountPrivilegeArgs args)
public AccountPrivilege(String name, AccountPrivilegeArgs args, CustomResourceOptions options)
type: volcengine:rds:AccountPrivilege
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. AccountPrivilegeArgs
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. AccountPrivilegeArgs
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. AccountPrivilegeArgs
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. AccountPrivilegeArgs
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. AccountPrivilegeArgs
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 accountPrivilegeResource = new Volcengine.Rds.AccountPrivilege("accountPrivilegeResource", new()
{
    AccountName = "string",
    DbPrivileges = new[]
    {
        new Volcengine.Rds.Inputs.AccountPrivilegeDbPrivilegeArgs
        {
            AccountPrivilege = "string",
            DbName = "string",
            AccountPrivilegeStr = "string",
        },
    },
    InstanceId = "string",
});
Copy
example, err := rds.NewAccountPrivilege(ctx, "accountPrivilegeResource", &rds.AccountPrivilegeArgs{
	AccountName: pulumi.String("string"),
	DbPrivileges: rds.AccountPrivilegeDbPrivilegeArray{
		&rds.AccountPrivilegeDbPrivilegeArgs{
			AccountPrivilege:    pulumi.String("string"),
			DbName:              pulumi.String("string"),
			AccountPrivilegeStr: pulumi.String("string"),
		},
	},
	InstanceId: pulumi.String("string"),
})
Copy
var accountPrivilegeResource = new AccountPrivilege("accountPrivilegeResource", AccountPrivilegeArgs.builder()
    .accountName("string")
    .dbPrivileges(AccountPrivilegeDbPrivilegeArgs.builder()
        .accountPrivilege("string")
        .dbName("string")
        .accountPrivilegeStr("string")
        .build())
    .instanceId("string")
    .build());
Copy
account_privilege_resource = volcengine.rds.AccountPrivilege("accountPrivilegeResource",
    account_name="string",
    db_privileges=[{
        "account_privilege": "string",
        "db_name": "string",
        "account_privilege_str": "string",
    }],
    instance_id="string")
Copy
const accountPrivilegeResource = new volcengine.rds.AccountPrivilege("accountPrivilegeResource", {
    accountName: "string",
    dbPrivileges: [{
        accountPrivilege: "string",
        dbName: "string",
        accountPrivilegeStr: "string",
    }],
    instanceId: "string",
});
Copy
type: volcengine:rds:AccountPrivilege
properties:
    accountName: string
    dbPrivileges:
        - accountPrivilege: string
          accountPrivilegeStr: string
          dbName: string
    instanceId: string
Copy

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

AccountName
This property is required.
Changes to this property will trigger replacement.
string
Database account name. The rules are as follows: Unique name. Start with a letter and end with a letter or number. Consists of lowercase letters, numbers, or underscores (_). The length is 2~32 characters. The keyword list is disabled for database accounts, and certain reserved words, including root, admin, etc., cannot be used.
DbPrivileges This property is required. List<AccountPrivilegeDbPrivilege>
The privileges of the account.
InstanceId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the RDS instance.
AccountName
This property is required.
Changes to this property will trigger replacement.
string
Database account name. The rules are as follows: Unique name. Start with a letter and end with a letter or number. Consists of lowercase letters, numbers, or underscores (_). The length is 2~32 characters. The keyword list is disabled for database accounts, and certain reserved words, including root, admin, etc., cannot be used.
DbPrivileges This property is required. []AccountPrivilegeDbPrivilegeArgs
The privileges of the account.
InstanceId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the RDS instance.
accountName
This property is required.
Changes to this property will trigger replacement.
String
Database account name. The rules are as follows: Unique name. Start with a letter and end with a letter or number. Consists of lowercase letters, numbers, or underscores (_). The length is 2~32 characters. The keyword list is disabled for database accounts, and certain reserved words, including root, admin, etc., cannot be used.
dbPrivileges This property is required. List<AccountPrivilegeDbPrivilege>
The privileges of the account.
instanceId
This property is required.
Changes to this property will trigger replacement.
String
The ID of the RDS instance.
accountName
This property is required.
Changes to this property will trigger replacement.
string
Database account name. The rules are as follows: Unique name. Start with a letter and end with a letter or number. Consists of lowercase letters, numbers, or underscores (_). The length is 2~32 characters. The keyword list is disabled for database accounts, and certain reserved words, including root, admin, etc., cannot be used.
dbPrivileges This property is required. AccountPrivilegeDbPrivilege[]
The privileges of the account.
instanceId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the RDS instance.
account_name
This property is required.
Changes to this property will trigger replacement.
str
Database account name. The rules are as follows: Unique name. Start with a letter and end with a letter or number. Consists of lowercase letters, numbers, or underscores (_). The length is 2~32 characters. The keyword list is disabled for database accounts, and certain reserved words, including root, admin, etc., cannot be used.
db_privileges This property is required. Sequence[AccountPrivilegeDbPrivilegeArgs]
The privileges of the account.
instance_id
This property is required.
Changes to this property will trigger replacement.
str
The ID of the RDS instance.
accountName
This property is required.
Changes to this property will trigger replacement.
String
Database account name. The rules are as follows: Unique name. Start with a letter and end with a letter or number. Consists of lowercase letters, numbers, or underscores (_). The length is 2~32 characters. The keyword list is disabled for database accounts, and certain reserved words, including root, admin, etc., cannot be used.
dbPrivileges This property is required. List<Property Map>
The privileges of the account.
instanceId
This property is required.
Changes to this property will trigger replacement.
String
The ID of the RDS instance.

Outputs

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

Get an existing AccountPrivilege 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?: AccountPrivilegeState, opts?: CustomResourceOptions): AccountPrivilege
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        account_name: Optional[str] = None,
        db_privileges: Optional[Sequence[AccountPrivilegeDbPrivilegeArgs]] = None,
        instance_id: Optional[str] = None) -> AccountPrivilege
func GetAccountPrivilege(ctx *Context, name string, id IDInput, state *AccountPrivilegeState, opts ...ResourceOption) (*AccountPrivilege, error)
public static AccountPrivilege Get(string name, Input<string> id, AccountPrivilegeState? state, CustomResourceOptions? opts = null)
public static AccountPrivilege get(String name, Output<String> id, AccountPrivilegeState state, CustomResourceOptions options)
resources:  _:    type: volcengine:rds:AccountPrivilege    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:
AccountName Changes to this property will trigger replacement. string
Database account name. The rules are as follows: Unique name. Start with a letter and end with a letter or number. Consists of lowercase letters, numbers, or underscores (_). The length is 2~32 characters. The keyword list is disabled for database accounts, and certain reserved words, including root, admin, etc., cannot be used.
DbPrivileges List<AccountPrivilegeDbPrivilege>
The privileges of the account.
InstanceId Changes to this property will trigger replacement. string
The ID of the RDS instance.
AccountName Changes to this property will trigger replacement. string
Database account name. The rules are as follows: Unique name. Start with a letter and end with a letter or number. Consists of lowercase letters, numbers, or underscores (_). The length is 2~32 characters. The keyword list is disabled for database accounts, and certain reserved words, including root, admin, etc., cannot be used.
DbPrivileges []AccountPrivilegeDbPrivilegeArgs
The privileges of the account.
InstanceId Changes to this property will trigger replacement. string
The ID of the RDS instance.
accountName Changes to this property will trigger replacement. String
Database account name. The rules are as follows: Unique name. Start with a letter and end with a letter or number. Consists of lowercase letters, numbers, or underscores (_). The length is 2~32 characters. The keyword list is disabled for database accounts, and certain reserved words, including root, admin, etc., cannot be used.
dbPrivileges List<AccountPrivilegeDbPrivilege>
The privileges of the account.
instanceId Changes to this property will trigger replacement. String
The ID of the RDS instance.
accountName Changes to this property will trigger replacement. string
Database account name. The rules are as follows: Unique name. Start with a letter and end with a letter or number. Consists of lowercase letters, numbers, or underscores (_). The length is 2~32 characters. The keyword list is disabled for database accounts, and certain reserved words, including root, admin, etc., cannot be used.
dbPrivileges AccountPrivilegeDbPrivilege[]
The privileges of the account.
instanceId Changes to this property will trigger replacement. string
The ID of the RDS instance.
account_name Changes to this property will trigger replacement. str
Database account name. The rules are as follows: Unique name. Start with a letter and end with a letter or number. Consists of lowercase letters, numbers, or underscores (_). The length is 2~32 characters. The keyword list is disabled for database accounts, and certain reserved words, including root, admin, etc., cannot be used.
db_privileges Sequence[AccountPrivilegeDbPrivilegeArgs]
The privileges of the account.
instance_id Changes to this property will trigger replacement. str
The ID of the RDS instance.
accountName Changes to this property will trigger replacement. String
Database account name. The rules are as follows: Unique name. Start with a letter and end with a letter or number. Consists of lowercase letters, numbers, or underscores (_). The length is 2~32 characters. The keyword list is disabled for database accounts, and certain reserved words, including root, admin, etc., cannot be used.
dbPrivileges List<Property Map>
The privileges of the account.
instanceId Changes to this property will trigger replacement. String
The ID of the RDS instance.

Supporting Types

AccountPrivilegeDbPrivilege
, AccountPrivilegeDbPrivilegeArgs

AccountPrivilege This property is required. string
The privilege type of the account.
DbName This property is required. string
The name of database.
AccountPrivilegeStr string
The privilege string of the account.
AccountPrivilege This property is required. string
The privilege type of the account.
DbName This property is required. string
The name of database.
AccountPrivilegeStr string
The privilege string of the account.
accountPrivilege This property is required. String
The privilege type of the account.
dbName This property is required. String
The name of database.
accountPrivilegeStr String
The privilege string of the account.
accountPrivilege This property is required. string
The privilege type of the account.
dbName This property is required. string
The name of database.
accountPrivilegeStr string
The privilege string of the account.
account_privilege This property is required. str
The privilege type of the account.
db_name This property is required. str
The name of database.
account_privilege_str str
The privilege string of the account.
accountPrivilege This property is required. String
The privilege type of the account.
dbName This property is required. String
The name of database.
accountPrivilegeStr String
The privilege string of the account.

Import

RDS account privilege can be imported using the id, e.g.

$ pulumi import volcengine:rds/accountPrivilege:AccountPrivilege default mysql-42b38c769c4b:account_name
Copy

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

Package Details

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