alicloud.gpdb.Database
Explore with Pulumi AI
Provides a GPDB Database resource.
For information about GPDB Database and how to use it, see What is Database.
NOTE: Available since v1.232.0.
Example Usage
Basic Usage
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
const config = new pulumi.Config();
const name = config.get("name") || "terraform-example";
const default35OkxY = new alicloud.vpc.Network("default35OkxY", {cidrBlock: "192.168.0.0/16"});
const defaultl8haQ3 = new alicloud.vpc.Switch("defaultl8haQ3", {
vpcId: default35OkxY.id,
zoneId: "cn-beijing-h",
cidrBlock: "192.168.1.0/24",
});
const defaultTC08a9 = new alicloud.gpdb.Instance("defaultTC08a9", {
instanceSpec: "2C8G",
segNodeNum: 2,
segStorageType: "cloud_essd",
instanceNetworkType: "VPC",
dbInstanceCategory: "Basic",
paymentType: "PayAsYouGo",
sslEnabled: 0,
engineVersion: "6.0",
engine: "gpdb",
zoneId: "cn-beijing-h",
vswitchId: defaultl8haQ3.id,
storageSize: 50,
masterCu: 4,
vpcId: default35OkxY.id,
dbInstanceMode: "StorageElastic",
});
const _default = new alicloud.gpdb.Database("default", {
characterSetName: "UTF8",
owner: "adbpgadmin",
description: "go-to-the-docks-for-french-fries",
databaseName: "seagull",
collate: "en_US.utf8",
ctype: "en_US.utf8",
dbInstanceId: defaultTC08a9.id,
});
import pulumi
import pulumi_alicloud as alicloud
config = pulumi.Config()
name = config.get("name")
if name is None:
name = "terraform-example"
default35_okx_y = alicloud.vpc.Network("default35OkxY", cidr_block="192.168.0.0/16")
defaultl8ha_q3 = alicloud.vpc.Switch("defaultl8haQ3",
vpc_id=default35_okx_y.id,
zone_id="cn-beijing-h",
cidr_block="192.168.1.0/24")
default_tc08a9 = alicloud.gpdb.Instance("defaultTC08a9",
instance_spec="2C8G",
seg_node_num=2,
seg_storage_type="cloud_essd",
instance_network_type="VPC",
db_instance_category="Basic",
payment_type="PayAsYouGo",
ssl_enabled=0,
engine_version="6.0",
engine="gpdb",
zone_id="cn-beijing-h",
vswitch_id=defaultl8ha_q3.id,
storage_size=50,
master_cu=4,
vpc_id=default35_okx_y.id,
db_instance_mode="StorageElastic")
default = alicloud.gpdb.Database("default",
character_set_name="UTF8",
owner="adbpgadmin",
description="go-to-the-docks-for-french-fries",
database_name="seagull",
collate="en_US.utf8",
ctype="en_US.utf8",
db_instance_id=default_tc08a9.id)
package main
import (
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/gpdb"
"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, "")
name := "terraform-example"
if param := cfg.Get("name"); param != "" {
name = param
}
default35OkxY, err := vpc.NewNetwork(ctx, "default35OkxY", &vpc.NetworkArgs{
CidrBlock: pulumi.String("192.168.0.0/16"),
})
if err != nil {
return err
}
defaultl8haQ3, err := vpc.NewSwitch(ctx, "defaultl8haQ3", &vpc.SwitchArgs{
VpcId: default35OkxY.ID(),
ZoneId: pulumi.String("cn-beijing-h"),
CidrBlock: pulumi.String("192.168.1.0/24"),
})
if err != nil {
return err
}
defaultTC08a9, err := gpdb.NewInstance(ctx, "defaultTC08a9", &gpdb.InstanceArgs{
InstanceSpec: pulumi.String("2C8G"),
SegNodeNum: pulumi.Int(2),
SegStorageType: pulumi.String("cloud_essd"),
InstanceNetworkType: pulumi.String("VPC"),
DbInstanceCategory: pulumi.String("Basic"),
PaymentType: pulumi.String("PayAsYouGo"),
SslEnabled: pulumi.Int(0),
EngineVersion: pulumi.String("6.0"),
Engine: pulumi.String("gpdb"),
ZoneId: pulumi.String("cn-beijing-h"),
VswitchId: defaultl8haQ3.ID(),
StorageSize: pulumi.Int(50),
MasterCu: pulumi.Int(4),
VpcId: default35OkxY.ID(),
DbInstanceMode: pulumi.String("StorageElastic"),
})
if err != nil {
return err
}
_, err = gpdb.NewDatabase(ctx, "default", &gpdb.DatabaseArgs{
CharacterSetName: pulumi.String("UTF8"),
Owner: pulumi.String("adbpgadmin"),
Description: pulumi.String("go-to-the-docks-for-french-fries"),
DatabaseName: pulumi.String("seagull"),
Collate: pulumi.String("en_US.utf8"),
Ctype: pulumi.String("en_US.utf8"),
DbInstanceId: defaultTC08a9.ID(),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() =>
{
var config = new Config();
var name = config.Get("name") ?? "terraform-example";
var default35OkxY = new AliCloud.Vpc.Network("default35OkxY", new()
{
CidrBlock = "192.168.0.0/16",
});
var defaultl8haQ3 = new AliCloud.Vpc.Switch("defaultl8haQ3", new()
{
VpcId = default35OkxY.Id,
ZoneId = "cn-beijing-h",
CidrBlock = "192.168.1.0/24",
});
var defaultTC08a9 = new AliCloud.Gpdb.Instance("defaultTC08a9", new()
{
InstanceSpec = "2C8G",
SegNodeNum = 2,
SegStorageType = "cloud_essd",
InstanceNetworkType = "VPC",
DbInstanceCategory = "Basic",
PaymentType = "PayAsYouGo",
SslEnabled = 0,
EngineVersion = "6.0",
Engine = "gpdb",
ZoneId = "cn-beijing-h",
VswitchId = defaultl8haQ3.Id,
StorageSize = 50,
MasterCu = 4,
VpcId = default35OkxY.Id,
DbInstanceMode = "StorageElastic",
});
var @default = new AliCloud.Gpdb.Database("default", new()
{
CharacterSetName = "UTF8",
Owner = "adbpgadmin",
Description = "go-to-the-docks-for-french-fries",
DatabaseName = "seagull",
Collate = "en_US.utf8",
Ctype = "en_US.utf8",
DbInstanceId = defaultTC08a9.Id,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
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.gpdb.Instance;
import com.pulumi.alicloud.gpdb.InstanceArgs;
import com.pulumi.alicloud.gpdb.Database;
import com.pulumi.alicloud.gpdb.DatabaseArgs;
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 name = config.get("name").orElse("terraform-example");
var default35OkxY = new Network("default35OkxY", NetworkArgs.builder()
.cidrBlock("192.168.0.0/16")
.build());
var defaultl8haQ3 = new Switch("defaultl8haQ3", SwitchArgs.builder()
.vpcId(default35OkxY.id())
.zoneId("cn-beijing-h")
.cidrBlock("192.168.1.0/24")
.build());
var defaultTC08a9 = new Instance("defaultTC08a9", InstanceArgs.builder()
.instanceSpec("2C8G")
.segNodeNum("2")
.segStorageType("cloud_essd")
.instanceNetworkType("VPC")
.dbInstanceCategory("Basic")
.paymentType("PayAsYouGo")
.sslEnabled("0")
.engineVersion("6.0")
.engine("gpdb")
.zoneId("cn-beijing-h")
.vswitchId(defaultl8haQ3.id())
.storageSize("50")
.masterCu("4")
.vpcId(default35OkxY.id())
.dbInstanceMode("StorageElastic")
.build());
var default_ = new Database("default", DatabaseArgs.builder()
.characterSetName("UTF8")
.owner("adbpgadmin")
.description("go-to-the-docks-for-french-fries")
.databaseName("seagull")
.collate("en_US.utf8")
.ctype("en_US.utf8")
.dbInstanceId(defaultTC08a9.id())
.build());
}
}
configuration:
name:
type: string
default: terraform-example
resources:
default35OkxY:
type: alicloud:vpc:Network
properties:
cidrBlock: 192.168.0.0/16
defaultl8haQ3:
type: alicloud:vpc:Switch
properties:
vpcId: ${default35OkxY.id}
zoneId: cn-beijing-h
cidrBlock: 192.168.1.0/24
defaultTC08a9:
type: alicloud:gpdb:Instance
properties:
instanceSpec: 2C8G
segNodeNum: '2'
segStorageType: cloud_essd
instanceNetworkType: VPC
dbInstanceCategory: Basic
paymentType: PayAsYouGo
sslEnabled: '0'
engineVersion: '6.0'
engine: gpdb
zoneId: cn-beijing-h
vswitchId: ${defaultl8haQ3.id}
storageSize: '50'
masterCu: '4'
vpcId: ${default35OkxY.id}
dbInstanceMode: StorageElastic
default:
type: alicloud:gpdb:Database
properties:
characterSetName: UTF8
owner: adbpgadmin
description: go-to-the-docks-for-french-fries
databaseName: seagull
collate: en_US.utf8
ctype: en_US.utf8
dbInstanceId: ${defaultTC08a9.id}
Create Database Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Database(name: string, args: DatabaseArgs, opts?: CustomResourceOptions);
@overload
def Database(resource_name: str,
args: DatabaseArgs,
opts: Optional[ResourceOptions] = None)
@overload
def Database(resource_name: str,
opts: Optional[ResourceOptions] = None,
database_name: Optional[str] = None,
db_instance_id: Optional[str] = None,
owner: Optional[str] = None,
character_set_name: Optional[str] = None,
collate: Optional[str] = None,
ctype: Optional[str] = None,
description: Optional[str] = None)
func NewDatabase(ctx *Context, name string, args DatabaseArgs, opts ...ResourceOption) (*Database, error)
public Database(string name, DatabaseArgs args, CustomResourceOptions? opts = null)
public Database(String name, DatabaseArgs args)
public Database(String name, DatabaseArgs args, CustomResourceOptions options)
type: alicloud:gpdb:Database
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 DatabaseArgs
- 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 DatabaseArgs
- 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 DatabaseArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args DatabaseArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args DatabaseArgs
- 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 databaseResource = new AliCloud.Gpdb.Database("databaseResource", new()
{
DatabaseName = "string",
DbInstanceId = "string",
Owner = "string",
CharacterSetName = "string",
Collate = "string",
Ctype = "string",
Description = "string",
});
example, err := gpdb.NewDatabase(ctx, "databaseResource", &gpdb.DatabaseArgs{
DatabaseName: pulumi.String("string"),
DbInstanceId: pulumi.String("string"),
Owner: pulumi.String("string"),
CharacterSetName: pulumi.String("string"),
Collate: pulumi.String("string"),
Ctype: pulumi.String("string"),
Description: pulumi.String("string"),
})
var databaseResource = new Database("databaseResource", DatabaseArgs.builder()
.databaseName("string")
.dbInstanceId("string")
.owner("string")
.characterSetName("string")
.collate("string")
.ctype("string")
.description("string")
.build());
database_resource = alicloud.gpdb.Database("databaseResource",
database_name="string",
db_instance_id="string",
owner="string",
character_set_name="string",
collate="string",
ctype="string",
description="string")
const databaseResource = new alicloud.gpdb.Database("databaseResource", {
databaseName: "string",
dbInstanceId: "string",
owner: "string",
characterSetName: "string",
collate: "string",
ctype: "string",
description: "string",
});
type: alicloud:gpdb:Database
properties:
characterSetName: string
collate: string
ctype: string
databaseName: string
dbInstanceId: string
description: string
owner: string
Database 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 Database resource accepts the following input properties:
- Database
Name string - Database Name
- Db
Instance stringId - Instance ID
- Owner string
- Data Sheet owner
- Character
Set stringName - Character set, default value is UTF8
- Collate string
- Database locale parameters, specifying string comparison/collation
- Ctype string
- Database locale parameters, specifying character classification/case conversion rules
- Description string
- Database Description
- Database
Name string - Database Name
- Db
Instance stringId - Instance ID
- Owner string
- Data Sheet owner
- Character
Set stringName - Character set, default value is UTF8
- Collate string
- Database locale parameters, specifying string comparison/collation
- Ctype string
- Database locale parameters, specifying character classification/case conversion rules
- Description string
- Database Description
- database
Name String - Database Name
- db
Instance StringId - Instance ID
- owner String
- Data Sheet owner
- character
Set StringName - Character set, default value is UTF8
- collate String
- Database locale parameters, specifying string comparison/collation
- ctype String
- Database locale parameters, specifying character classification/case conversion rules
- description String
- Database Description
- database
Name string - Database Name
- db
Instance stringId - Instance ID
- owner string
- Data Sheet owner
- character
Set stringName - Character set, default value is UTF8
- collate string
- Database locale parameters, specifying string comparison/collation
- ctype string
- Database locale parameters, specifying character classification/case conversion rules
- description string
- Database Description
- database_
name str - Database Name
- db_
instance_ strid - Instance ID
- owner str
- Data Sheet owner
- character_
set_ strname - Character set, default value is UTF8
- collate str
- Database locale parameters, specifying string comparison/collation
- ctype str
- Database locale parameters, specifying character classification/case conversion rules
- description str
- Database Description
- database
Name String - Database Name
- db
Instance StringId - Instance ID
- owner String
- Data Sheet owner
- character
Set StringName - Character set, default value is UTF8
- collate String
- Database locale parameters, specifying string comparison/collation
- ctype String
- Database locale parameters, specifying character classification/case conversion rules
- description String
- Database Description
Outputs
All input properties are implicitly available as output properties. Additionally, the Database 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 Database Resource
Get an existing Database 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?: DatabaseState, opts?: CustomResourceOptions): Database
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
character_set_name: Optional[str] = None,
collate: Optional[str] = None,
ctype: Optional[str] = None,
database_name: Optional[str] = None,
db_instance_id: Optional[str] = None,
description: Optional[str] = None,
owner: Optional[str] = None) -> Database
func GetDatabase(ctx *Context, name string, id IDInput, state *DatabaseState, opts ...ResourceOption) (*Database, error)
public static Database Get(string name, Input<string> id, DatabaseState? state, CustomResourceOptions? opts = null)
public static Database get(String name, Output<String> id, DatabaseState 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.
- Character
Set stringName - Character set, default value is UTF8
- Collate string
- Database locale parameters, specifying string comparison/collation
- Ctype string
- Database locale parameters, specifying character classification/case conversion rules
- Database
Name string - Database Name
- Db
Instance stringId - Instance ID
- Description string
- Database Description
- Owner string
- Data Sheet owner
- Character
Set stringName - Character set, default value is UTF8
- Collate string
- Database locale parameters, specifying string comparison/collation
- Ctype string
- Database locale parameters, specifying character classification/case conversion rules
- Database
Name string - Database Name
- Db
Instance stringId - Instance ID
- Description string
- Database Description
- Owner string
- Data Sheet owner
- character
Set StringName - Character set, default value is UTF8
- collate String
- Database locale parameters, specifying string comparison/collation
- ctype String
- Database locale parameters, specifying character classification/case conversion rules
- database
Name String - Database Name
- db
Instance StringId - Instance ID
- description String
- Database Description
- owner String
- Data Sheet owner
- character
Set stringName - Character set, default value is UTF8
- collate string
- Database locale parameters, specifying string comparison/collation
- ctype string
- Database locale parameters, specifying character classification/case conversion rules
- database
Name string - Database Name
- db
Instance stringId - Instance ID
- description string
- Database Description
- owner string
- Data Sheet owner
- character_
set_ strname - Character set, default value is UTF8
- collate str
- Database locale parameters, specifying string comparison/collation
- ctype str
- Database locale parameters, specifying character classification/case conversion rules
- database_
name str - Database Name
- db_
instance_ strid - Instance ID
- description str
- Database Description
- owner str
- Data Sheet owner
- character
Set StringName - Character set, default value is UTF8
- collate String
- Database locale parameters, specifying string comparison/collation
- ctype String
- Database locale parameters, specifying character classification/case conversion rules
- database
Name String - Database Name
- db
Instance StringId - Instance ID
- description String
- Database Description
- owner String
- Data Sheet owner
Import
GPDB Database can be imported using the id, e.g.
$ pulumi import alicloud:gpdb/database:Database example <db_instance_id>:<database_name>
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- Alibaba Cloud pulumi/pulumi-alicloud
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
alicloud
Terraform Provider.