alicloud logo
Alibaba Cloud v3.34.0, Mar 17 23

alicloud.adb.Account

Provides a ADB account resource and used to manage databases.

NOTE: Available in v1.71.0+.

Example Usage

using System.Collections.Generic;
using Pulumi;
using AliCloud = Pulumi.AliCloud;

return await Deployment.RunAsync(() => 
{
    var config = new Config();
    var creation = config.Get("creation") ?? "ADB";
    var name = config.Get("name") ?? "adbaccountmysql";
    var defaultZones = AliCloud.GetZones.Invoke(new()
    {
        AvailableResourceCreation = creation,
    });

    var defaultNetwork = new AliCloud.Vpc.Network("defaultNetwork", new()
    {
        CidrBlock = "172.16.0.0/16",
    });

    var defaultSwitch = new AliCloud.Vpc.Switch("defaultSwitch", new()
    {
        VpcId = defaultNetwork.Id,
        CidrBlock = "172.16.0.0/24",
        ZoneId = defaultZones.Apply(getZonesResult => getZonesResult.Zones[0]?.Id),
    });

    var cluster = new AliCloud.Adb.Cluster("cluster", new()
    {
        DbClusterVersion = "3.0",
        DbClusterCategory = "Cluster",
        DbNodeClass = "C8",
        DbNodeCount = 2,
        DbNodeStorage = 200,
        PayType = "PostPaid",
        VswitchId = defaultSwitch.Id,
        Description = name,
    });

    var account = new AliCloud.Adb.Account("account", new()
    {
        DbClusterId = cluster.Id,
        AccountName = "tftestnormal",
        AccountPassword = "Test12345",
        AccountDescription = name,
    });

});
package main

import (
	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud"
	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/adb"
	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/vpc"
	"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, "")
		creation := "ADB"
		if param := cfg.Get("creation"); param != "" {
			creation = param
		}
		name := "adbaccountmysql"
		if param := cfg.Get("name"); param != "" {
			name = param
		}
		defaultZones, err := alicloud.GetZones(ctx, &alicloud.GetZonesArgs{
			AvailableResourceCreation: pulumi.StringRef(creation),
		}, nil)
		if err != nil {
			return err
		}
		defaultNetwork, err := vpc.NewNetwork(ctx, "defaultNetwork", &vpc.NetworkArgs{
			CidrBlock: pulumi.String("172.16.0.0/16"),
		})
		if err != nil {
			return err
		}
		defaultSwitch, err := vpc.NewSwitch(ctx, "defaultSwitch", &vpc.SwitchArgs{
			VpcId:     defaultNetwork.ID(),
			CidrBlock: pulumi.String("172.16.0.0/24"),
			ZoneId:    *pulumi.String(defaultZones.Zones[0].Id),
		})
		if err != nil {
			return err
		}
		cluster, err := adb.NewCluster(ctx, "cluster", &adb.ClusterArgs{
			DbClusterVersion:  pulumi.String("3.0"),
			DbClusterCategory: pulumi.String("Cluster"),
			DbNodeClass:       pulumi.String("C8"),
			DbNodeCount:       pulumi.Int(2),
			DbNodeStorage:     pulumi.Int(200),
			PayType:           pulumi.String("PostPaid"),
			VswitchId:         defaultSwitch.ID(),
			Description:       pulumi.String(name),
		})
		if err != nil {
			return err
		}
		_, err = adb.NewAccount(ctx, "account", &adb.AccountArgs{
			DbClusterId:        cluster.ID(),
			AccountName:        pulumi.String("tftestnormal"),
			AccountPassword:    pulumi.String("Test12345"),
			AccountDescription: pulumi.String(name),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.AlicloudFunctions;
import com.pulumi.alicloud.inputs.GetZonesArgs;
import com.pulumi.alicloud.vpc.Network;
import com.pulumi.alicloud.vpc.NetworkArgs;
import com.pulumi.alicloud.vpc.Switch;
import com.pulumi.alicloud.vpc.SwitchArgs;
import com.pulumi.alicloud.adb.Cluster;
import com.pulumi.alicloud.adb.ClusterArgs;
import com.pulumi.alicloud.adb.Account;
import com.pulumi.alicloud.adb.AccountArgs;
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 creation = config.get("creation").orElse("ADB");
        final var name = config.get("name").orElse("adbaccountmysql");
        final var defaultZones = AlicloudFunctions.getZones(GetZonesArgs.builder()
            .availableResourceCreation(creation)
            .build());

        var defaultNetwork = new Network("defaultNetwork", NetworkArgs.builder()        
            .cidrBlock("172.16.0.0/16")
            .build());

        var defaultSwitch = new Switch("defaultSwitch", SwitchArgs.builder()        
            .vpcId(defaultNetwork.id())
            .cidrBlock("172.16.0.0/24")
            .zoneId(defaultZones.applyValue(getZonesResult -> getZonesResult.zones()[0].id()))
            .build());

        var cluster = new Cluster("cluster", ClusterArgs.builder()        
            .dbClusterVersion("3.0")
            .dbClusterCategory("Cluster")
            .dbNodeClass("C8")
            .dbNodeCount(2)
            .dbNodeStorage(200)
            .payType("PostPaid")
            .vswitchId(defaultSwitch.id())
            .description(name)
            .build());

        var account = new Account("account", AccountArgs.builder()        
            .dbClusterId(cluster.id())
            .accountName("tftestnormal")
            .accountPassword("Test12345")
            .accountDescription(name)
            .build());

    }
}
import pulumi
import pulumi_alicloud as alicloud

config = pulumi.Config()
creation = config.get("creation")
if creation is None:
    creation = "ADB"
name = config.get("name")
if name is None:
    name = "adbaccountmysql"
default_zones = alicloud.get_zones(available_resource_creation=creation)
default_network = alicloud.vpc.Network("defaultNetwork", cidr_block="172.16.0.0/16")
default_switch = alicloud.vpc.Switch("defaultSwitch",
    vpc_id=default_network.id,
    cidr_block="172.16.0.0/24",
    zone_id=default_zones.zones[0].id)
cluster = alicloud.adb.Cluster("cluster",
    db_cluster_version="3.0",
    db_cluster_category="Cluster",
    db_node_class="C8",
    db_node_count=2,
    db_node_storage=200,
    pay_type="PostPaid",
    vswitch_id=default_switch.id,
    description=name)
account = alicloud.adb.Account("account",
    db_cluster_id=cluster.id,
    account_name="tftestnormal",
    account_password="Test12345",
    account_description=name)
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";

const config = new pulumi.Config();
const creation = config.get("creation") || "ADB";
const name = config.get("name") || "adbaccountmysql";
const defaultZones = alicloud.getZones({
    availableResourceCreation: creation,
});
const defaultNetwork = new alicloud.vpc.Network("defaultNetwork", {cidrBlock: "172.16.0.0/16"});
const defaultSwitch = new alicloud.vpc.Switch("defaultSwitch", {
    vpcId: defaultNetwork.id,
    cidrBlock: "172.16.0.0/24",
    zoneId: defaultZones.then(defaultZones => defaultZones.zones?.[0]?.id),
});
const cluster = new alicloud.adb.Cluster("cluster", {
    dbClusterVersion: "3.0",
    dbClusterCategory: "Cluster",
    dbNodeClass: "C8",
    dbNodeCount: 2,
    dbNodeStorage: 200,
    payType: "PostPaid",
    vswitchId: defaultSwitch.id,
    description: name,
});
const account = new alicloud.adb.Account("account", {
    dbClusterId: cluster.id,
    accountName: "tftestnormal",
    accountPassword: "Test12345",
    accountDescription: name,
});
configuration:
  creation:
    type: string
    default: ADB
  name:
    type: string
    default: adbaccountmysql
resources:
  defaultNetwork:
    type: alicloud:vpc:Network
    properties:
      cidrBlock: 172.16.0.0/16
  defaultSwitch:
    type: alicloud:vpc:Switch
    properties:
      vpcId: ${defaultNetwork.id}
      cidrBlock: 172.16.0.0/24
      zoneId: ${defaultZones.zones[0].id}
  cluster:
    type: alicloud:adb:Cluster
    properties:
      dbClusterVersion: '3.0'
      dbClusterCategory: Cluster
      dbNodeClass: C8
      dbNodeCount: 2
      dbNodeStorage: 200
      payType: PostPaid
      vswitchId: ${defaultSwitch.id}
      description: ${name}
  account:
    type: alicloud:adb:Account
    properties:
      dbClusterId: ${cluster.id}
      accountName: tftestnormal
      accountPassword: Test12345
      accountDescription: ${name}
variables:
  defaultZones:
    fn::invoke:
      Function: alicloud:getZones
      Arguments:
        availableResourceCreation: ${creation}

Create Account Resource

new Account(name: string, args: AccountArgs, opts?: CustomResourceOptions);
@overload
def Account(resource_name: str,
            opts: Optional[ResourceOptions] = None,
            account_description: Optional[str] = None,
            account_name: Optional[str] = None,
            account_password: Optional[str] = None,
            db_cluster_id: Optional[str] = None,
            kms_encrypted_password: Optional[str] = None,
            kms_encryption_context: Optional[Mapping[str, Any]] = None)
@overload
def Account(resource_name: str,
            args: AccountArgs,
            opts: Optional[ResourceOptions] = None)
func NewAccount(ctx *Context, name string, args AccountArgs, opts ...ResourceOption) (*Account, error)
public Account(string name, AccountArgs args, CustomResourceOptions? opts = null)
public Account(String name, AccountArgs args)
public Account(String name, AccountArgs args, CustomResourceOptions options)
type: alicloud:adb:Account
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args AccountArgs
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 AccountArgs
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 AccountArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args AccountArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args AccountArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

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

AccountName string

Operation account requiring a uniqueness check. It may consist of lower case letters, numbers, and underlines, and must start with a letter and have no more than 16 characters.

DbClusterId string

The Id of cluster in which account belongs.

AccountDescription string

Account description. It cannot begin with https://. It must start with a Chinese character or English letter. It can include Chinese and English characters, underlines (_), hyphens (-), and numbers. The length may be 2-256 characters.

AccountPassword string

Operation password. It may consist of letters, digits, or underlines, with a length of 6 to 32 characters. You have to specify one of account_password and kms_encrypted_password fields.

KmsEncryptedPassword string

An KMS encrypts password used to a db account. If the account_password is filled in, this field will be ignored.

KmsEncryptionContext Dictionary<string, object>

An KMS encryption context used to decrypt kms_encrypted_password before creating or updating a db account with kms_encrypted_password. See Encryption Context. It is valid when kms_encrypted_password is set.

AccountName string

Operation account requiring a uniqueness check. It may consist of lower case letters, numbers, and underlines, and must start with a letter and have no more than 16 characters.

DbClusterId string

The Id of cluster in which account belongs.

AccountDescription string

Account description. It cannot begin with https://. It must start with a Chinese character or English letter. It can include Chinese and English characters, underlines (_), hyphens (-), and numbers. The length may be 2-256 characters.

AccountPassword string

Operation password. It may consist of letters, digits, or underlines, with a length of 6 to 32 characters. You have to specify one of account_password and kms_encrypted_password fields.

KmsEncryptedPassword string

An KMS encrypts password used to a db account. If the account_password is filled in, this field will be ignored.

KmsEncryptionContext map[string]interface{}

An KMS encryption context used to decrypt kms_encrypted_password before creating or updating a db account with kms_encrypted_password. See Encryption Context. It is valid when kms_encrypted_password is set.

accountName String

Operation account requiring a uniqueness check. It may consist of lower case letters, numbers, and underlines, and must start with a letter and have no more than 16 characters.

dbClusterId String

The Id of cluster in which account belongs.

accountDescription String

Account description. It cannot begin with https://. It must start with a Chinese character or English letter. It can include Chinese and English characters, underlines (_), hyphens (-), and numbers. The length may be 2-256 characters.

accountPassword String

Operation password. It may consist of letters, digits, or underlines, with a length of 6 to 32 characters. You have to specify one of account_password and kms_encrypted_password fields.

kmsEncryptedPassword String

An KMS encrypts password used to a db account. If the account_password is filled in, this field will be ignored.

kmsEncryptionContext Map<String,Object>

An KMS encryption context used to decrypt kms_encrypted_password before creating or updating a db account with kms_encrypted_password. See Encryption Context. It is valid when kms_encrypted_password is set.

accountName string

Operation account requiring a uniqueness check. It may consist of lower case letters, numbers, and underlines, and must start with a letter and have no more than 16 characters.

dbClusterId string

The Id of cluster in which account belongs.

accountDescription string

Account description. It cannot begin with https://. It must start with a Chinese character or English letter. It can include Chinese and English characters, underlines (_), hyphens (-), and numbers. The length may be 2-256 characters.

accountPassword string

Operation password. It may consist of letters, digits, or underlines, with a length of 6 to 32 characters. You have to specify one of account_password and kms_encrypted_password fields.

kmsEncryptedPassword string

An KMS encrypts password used to a db account. If the account_password is filled in, this field will be ignored.

kmsEncryptionContext {[key: string]: any}

An KMS encryption context used to decrypt kms_encrypted_password before creating or updating a db account with kms_encrypted_password. See Encryption Context. It is valid when kms_encrypted_password is set.

account_name str

Operation account requiring a uniqueness check. It may consist of lower case letters, numbers, and underlines, and must start with a letter and have no more than 16 characters.

db_cluster_id str

The Id of cluster in which account belongs.

account_description str

Account description. It cannot begin with https://. It must start with a Chinese character or English letter. It can include Chinese and English characters, underlines (_), hyphens (-), and numbers. The length may be 2-256 characters.

account_password str

Operation password. It may consist of letters, digits, or underlines, with a length of 6 to 32 characters. You have to specify one of account_password and kms_encrypted_password fields.

kms_encrypted_password str

An KMS encrypts password used to a db account. If the account_password is filled in, this field will be ignored.

kms_encryption_context Mapping[str, Any]

An KMS encryption context used to decrypt kms_encrypted_password before creating or updating a db account with kms_encrypted_password. See Encryption Context. It is valid when kms_encrypted_password is set.

accountName String

Operation account requiring a uniqueness check. It may consist of lower case letters, numbers, and underlines, and must start with a letter and have no more than 16 characters.

dbClusterId String

The Id of cluster in which account belongs.

accountDescription String

Account description. It cannot begin with https://. It must start with a Chinese character or English letter. It can include Chinese and English characters, underlines (_), hyphens (-), and numbers. The length may be 2-256 characters.

accountPassword String

Operation password. It may consist of letters, digits, or underlines, with a length of 6 to 32 characters. You have to specify one of account_password and kms_encrypted_password fields.

kmsEncryptedPassword String

An KMS encrypts password used to a db account. If the account_password is filled in, this field will be ignored.

kmsEncryptionContext Map<Any>

An KMS encryption context used to decrypt kms_encrypted_password before creating or updating a db account with kms_encrypted_password. See Encryption Context. It is valid when kms_encrypted_password is set.

Outputs

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

Get an existing Account 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?: AccountState, opts?: CustomResourceOptions): Account
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        account_description: Optional[str] = None,
        account_name: Optional[str] = None,
        account_password: Optional[str] = None,
        db_cluster_id: Optional[str] = None,
        kms_encrypted_password: Optional[str] = None,
        kms_encryption_context: Optional[Mapping[str, Any]] = None) -> Account
func GetAccount(ctx *Context, name string, id IDInput, state *AccountState, opts ...ResourceOption) (*Account, error)
public static Account Get(string name, Input<string> id, AccountState? state, CustomResourceOptions? opts = null)
public static Account get(String name, Output<String> id, AccountState 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:
AccountDescription string

Account description. It cannot begin with https://. It must start with a Chinese character or English letter. It can include Chinese and English characters, underlines (_), hyphens (-), and numbers. The length may be 2-256 characters.

AccountName string

Operation account requiring a uniqueness check. It may consist of lower case letters, numbers, and underlines, and must start with a letter and have no more than 16 characters.

AccountPassword string

Operation password. It may consist of letters, digits, or underlines, with a length of 6 to 32 characters. You have to specify one of account_password and kms_encrypted_password fields.

DbClusterId string

The Id of cluster in which account belongs.

KmsEncryptedPassword string

An KMS encrypts password used to a db account. If the account_password is filled in, this field will be ignored.

KmsEncryptionContext Dictionary<string, object>

An KMS encryption context used to decrypt kms_encrypted_password before creating or updating a db account with kms_encrypted_password. See Encryption Context. It is valid when kms_encrypted_password is set.

AccountDescription string

Account description. It cannot begin with https://. It must start with a Chinese character or English letter. It can include Chinese and English characters, underlines (_), hyphens (-), and numbers. The length may be 2-256 characters.

AccountName string

Operation account requiring a uniqueness check. It may consist of lower case letters, numbers, and underlines, and must start with a letter and have no more than 16 characters.

AccountPassword string

Operation password. It may consist of letters, digits, or underlines, with a length of 6 to 32 characters. You have to specify one of account_password and kms_encrypted_password fields.

DbClusterId string

The Id of cluster in which account belongs.

KmsEncryptedPassword string

An KMS encrypts password used to a db account. If the account_password is filled in, this field will be ignored.

KmsEncryptionContext map[string]interface{}

An KMS encryption context used to decrypt kms_encrypted_password before creating or updating a db account with kms_encrypted_password. See Encryption Context. It is valid when kms_encrypted_password is set.

accountDescription String

Account description. It cannot begin with https://. It must start with a Chinese character or English letter. It can include Chinese and English characters, underlines (_), hyphens (-), and numbers. The length may be 2-256 characters.

accountName String

Operation account requiring a uniqueness check. It may consist of lower case letters, numbers, and underlines, and must start with a letter and have no more than 16 characters.

accountPassword String

Operation password. It may consist of letters, digits, or underlines, with a length of 6 to 32 characters. You have to specify one of account_password and kms_encrypted_password fields.

dbClusterId String

The Id of cluster in which account belongs.

kmsEncryptedPassword String

An KMS encrypts password used to a db account. If the account_password is filled in, this field will be ignored.

kmsEncryptionContext Map<String,Object>

An KMS encryption context used to decrypt kms_encrypted_password before creating or updating a db account with kms_encrypted_password. See Encryption Context. It is valid when kms_encrypted_password is set.

accountDescription string

Account description. It cannot begin with https://. It must start with a Chinese character or English letter. It can include Chinese and English characters, underlines (_), hyphens (-), and numbers. The length may be 2-256 characters.

accountName string

Operation account requiring a uniqueness check. It may consist of lower case letters, numbers, and underlines, and must start with a letter and have no more than 16 characters.

accountPassword string

Operation password. It may consist of letters, digits, or underlines, with a length of 6 to 32 characters. You have to specify one of account_password and kms_encrypted_password fields.

dbClusterId string

The Id of cluster in which account belongs.

kmsEncryptedPassword string

An KMS encrypts password used to a db account. If the account_password is filled in, this field will be ignored.

kmsEncryptionContext {[key: string]: any}

An KMS encryption context used to decrypt kms_encrypted_password before creating or updating a db account with kms_encrypted_password. See Encryption Context. It is valid when kms_encrypted_password is set.

account_description str

Account description. It cannot begin with https://. It must start with a Chinese character or English letter. It can include Chinese and English characters, underlines (_), hyphens (-), and numbers. The length may be 2-256 characters.

account_name str

Operation account requiring a uniqueness check. It may consist of lower case letters, numbers, and underlines, and must start with a letter and have no more than 16 characters.

account_password str

Operation password. It may consist of letters, digits, or underlines, with a length of 6 to 32 characters. You have to specify one of account_password and kms_encrypted_password fields.

db_cluster_id str

The Id of cluster in which account belongs.

kms_encrypted_password str

An KMS encrypts password used to a db account. If the account_password is filled in, this field will be ignored.

kms_encryption_context Mapping[str, Any]

An KMS encryption context used to decrypt kms_encrypted_password before creating or updating a db account with kms_encrypted_password. See Encryption Context. It is valid when kms_encrypted_password is set.

accountDescription String

Account description. It cannot begin with https://. It must start with a Chinese character or English letter. It can include Chinese and English characters, underlines (_), hyphens (-), and numbers. The length may be 2-256 characters.

accountName String

Operation account requiring a uniqueness check. It may consist of lower case letters, numbers, and underlines, and must start with a letter and have no more than 16 characters.

accountPassword String

Operation password. It may consist of letters, digits, or underlines, with a length of 6 to 32 characters. You have to specify one of account_password and kms_encrypted_password fields.

dbClusterId String

The Id of cluster in which account belongs.

kmsEncryptedPassword String

An KMS encrypts password used to a db account. If the account_password is filled in, this field will be ignored.

kmsEncryptionContext Map<Any>

An KMS encryption context used to decrypt kms_encrypted_password before creating or updating a db account with kms_encrypted_password. See Encryption Context. It is valid when kms_encrypted_password is set.

Import

ADB account can be imported using the id, e.g.

 $ pulumi import alicloud:adb/account:Account example am-12345:tf_account

Package Details

Repository
Alibaba Cloud pulumi/pulumi-alicloud
License
Apache-2.0
Notes

This Pulumi package is based on the alicloud Terraform Provider.