@volcengine/pulumi
Version:
A Pulumi package for creating and managing volcengine cloud resources.
276 lines • 13.8 kB
JavaScript
;
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.Instance = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Provides a resource to manage rds postgresql instance
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as volcengine from "@pulumi/volcengine";
* import * as volcengine from "@volcengine/pulumi";
*
* const fooZones = volcengine.rds_postgresql.getZones({});
* // create vpc
* const fooVpc = new volcengine.vpc.Vpc("fooVpc", {
* vpcName: "acc-test-vpc",
* cidrBlock: "172.16.0.0/16",
* dnsServers: [
* "8.8.8.8",
* "114.114.114.114",
* ],
* projectName: "default",
* });
* // create subnet
* const fooSubnet = new volcengine.vpc.Subnet("fooSubnet", {
* subnetName: "acc-test-subnet",
* cidrBlock: "172.16.0.0/24",
* zoneId: data.volcengine_zones.foo.zones[0].id,
* vpcId: fooVpc.id,
* });
* // create postgresql instance
* const fooInstance = new volcengine.rds_postgresql.Instance("fooInstance", {
* dbEngineVersion: "PostgreSQL_12",
* nodeSpec: "rds.postgres.1c2g",
* primaryZoneId: data.volcengine_zones.foo.zones[0].id,
* secondaryZoneId: data.volcengine_zones.foo.zones[0].id,
* storageSpace: 40,
* subnetId: fooSubnet.id,
* instanceName: "acc-test-postgresql-instance",
* chargeInfo: {
* chargeType: "PostPaid",
* },
* projectName: "default",
* tags: [{
* key: "tfk1",
* value: "tfv1",
* }],
* parameters: [
* {
* name: "auto_explain.log_analyze",
* value: "off",
* },
* {
* name: "auto_explain.log_format",
* value: "text",
* },
* ],
* });
* // create postgresql instance readonly node
* const fooInstanceReadonlyNode = new volcengine.rds_postgresql.InstanceReadonlyNode("fooInstanceReadonlyNode", {
* instanceId: fooInstance.id,
* nodeSpec: "rds.postgres.1c2g",
* zoneId: data.volcengine_zones.foo.zones[0].id,
* });
* // create postgresql allow list
* const fooAllowlist = new volcengine.rds_postgresql.Allowlist("fooAllowlist", {
* allowListName: "acc-test-allowlist",
* allowListDesc: "acc-test",
* allowListType: "IPv4",
* allowLists: [
* "192.168.0.0/24",
* "192.168.1.0/24",
* ],
* });
* // associate postgresql allow list to postgresql instance
* const fooAllowlistAssociate = new volcengine.rds_postgresql.AllowlistAssociate("fooAllowlistAssociate", {
* instanceId: fooInstance.id,
* allowListId: fooAllowlist.id,
* });
* // create postgresql database
* const fooDatabase = new volcengine.rds_postgresql.Database("fooDatabase", {
* dbName: "acc-test-database",
* instanceId: fooInstance.id,
* cType: "C",
* collate: "zh_CN.utf8",
* });
* // create postgresql account
* const fooAccount = new volcengine.rds_postgresql.Account("fooAccount", {
* accountName: "acc-test-account",
* accountPassword: "9wc@********12",
* accountType: "Normal",
* instanceId: fooInstance.id,
* accountPrivileges: "Inherit,Login,CreateRole,CreateDB",
* });
* // create postgresql schema
* const fooSchema = new volcengine.rds_postgresql.Schema("fooSchema", {
* dbName: fooDatabase.dbName,
* instanceId: fooInstance.id,
* owner: fooAccount.accountName,
* schemaName: "acc-test-schema",
* });
* // Restore the backup to a new instance
* const example = new volcengine.rds_postgresql.Instance("example", {
* srcInstanceId: "postgres-faa4921fdde4",
* backupId: "20251215-215628F",
* dbEngineVersion: "PostgreSQL_12",
* nodeSpec: "rds.postgres.1c2g",
* subnetId: fooSubnet.id,
* instanceName: "acc-test-postgresql-instance-restore",
* chargeInfo: {
* chargeType: "PostPaid",
* number: 1,
* },
* primaryZoneId: data.volcengine_zones.foo.zones[0].id,
* secondaryZoneId: data.volcengine_zones.foo.zones[0].id,
* });
* ```
*
* ## Import
*
* RdsPostgresqlInstance can be imported using the id, e.g.
*
* ```sh
* $ pulumi import volcengine:rds_postgresql/instance:Instance default postgres-21a3333b****
* ```
*/
class Instance extends pulumi.CustomResource {
/**
* Get an existing Instance resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param state Any extra arguments used during the lookup.
* @param opts Optional settings to control the behavior of the CustomResource.
*/
static get(name, id, state, opts) {
return new Instance(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of Instance. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj) {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === Instance.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["allowListIds"] = state ? state.allowListIds : undefined;
resourceInputs["allowListVersion"] = state ? state.allowListVersion : undefined;
resourceInputs["backupId"] = state ? state.backupId : undefined;
resourceInputs["backupUse"] = state ? state.backupUse : undefined;
resourceInputs["chargeDetails"] = state ? state.chargeDetails : undefined;
resourceInputs["chargeInfo"] = state ? state.chargeInfo : undefined;
resourceInputs["createTime"] = state ? state.createTime : undefined;
resourceInputs["dataSyncMode"] = state ? state.dataSyncMode : undefined;
resourceInputs["dbEngineVersion"] = state ? state.dbEngineVersion : undefined;
resourceInputs["endpoints"] = state ? state.endpoints : undefined;
resourceInputs["estimateOnly"] = state ? state.estimateOnly : undefined;
resourceInputs["estimationResults"] = state ? state.estimationResults : undefined;
resourceInputs["instanceId"] = state ? state.instanceId : undefined;
resourceInputs["instanceName"] = state ? state.instanceName : undefined;
resourceInputs["instanceStatus"] = state ? state.instanceStatus : undefined;
resourceInputs["instanceType"] = state ? state.instanceType : undefined;
resourceInputs["memory"] = state ? state.memory : undefined;
resourceInputs["modifyType"] = state ? state.modifyType : undefined;
resourceInputs["nodeNumber"] = state ? state.nodeNumber : undefined;
resourceInputs["nodeSpec"] = state ? state.nodeSpec : undefined;
resourceInputs["nodes"] = state ? state.nodes : undefined;
resourceInputs["parameters"] = state ? state.parameters : undefined;
resourceInputs["primaryZoneId"] = state ? state.primaryZoneId : undefined;
resourceInputs["projectName"] = state ? state.projectName : undefined;
resourceInputs["regionId"] = state ? state.regionId : undefined;
resourceInputs["restoreTime"] = state ? state.restoreTime : undefined;
resourceInputs["rollbackTime"] = state ? state.rollbackTime : undefined;
resourceInputs["secondaryZoneId"] = state ? state.secondaryZoneId : undefined;
resourceInputs["srcInstanceId"] = state ? state.srcInstanceId : undefined;
resourceInputs["storageDataUse"] = state ? state.storageDataUse : undefined;
resourceInputs["storageLogUse"] = state ? state.storageLogUse : undefined;
resourceInputs["storageSpace"] = state ? state.storageSpace : undefined;
resourceInputs["storageTempUse"] = state ? state.storageTempUse : undefined;
resourceInputs["storageType"] = state ? state.storageType : undefined;
resourceInputs["storageUse"] = state ? state.storageUse : undefined;
resourceInputs["storageWalUse"] = state ? state.storageWalUse : undefined;
resourceInputs["subnetId"] = state ? state.subnetId : undefined;
resourceInputs["tags"] = state ? state.tags : undefined;
resourceInputs["updateTime"] = state ? state.updateTime : undefined;
resourceInputs["vCpu"] = state ? state.vCpu : undefined;
resourceInputs["vpcId"] = state ? state.vpcId : undefined;
resourceInputs["zoneId"] = state ? state.zoneId : undefined;
resourceInputs["zoneIds"] = state ? state.zoneIds : undefined;
resourceInputs["zoneMigrations"] = state ? state.zoneMigrations : undefined;
}
else {
const args = argsOrState;
if ((!args || args.chargeInfo === undefined) && !opts.urn) {
throw new Error("Missing required property 'chargeInfo'");
}
if ((!args || args.dbEngineVersion === undefined) && !opts.urn) {
throw new Error("Missing required property 'dbEngineVersion'");
}
if ((!args || args.nodeSpec === undefined) && !opts.urn) {
throw new Error("Missing required property 'nodeSpec'");
}
if ((!args || args.primaryZoneId === undefined) && !opts.urn) {
throw new Error("Missing required property 'primaryZoneId'");
}
if ((!args || args.secondaryZoneId === undefined) && !opts.urn) {
throw new Error("Missing required property 'secondaryZoneId'");
}
if ((!args || args.subnetId === undefined) && !opts.urn) {
throw new Error("Missing required property 'subnetId'");
}
resourceInputs["allowListIds"] = args ? args.allowListIds : undefined;
resourceInputs["backupId"] = args ? args.backupId : undefined;
resourceInputs["chargeInfo"] = args ? args.chargeInfo : undefined;
resourceInputs["dbEngineVersion"] = args ? args.dbEngineVersion : undefined;
resourceInputs["estimateOnly"] = args ? args.estimateOnly : undefined;
resourceInputs["instanceName"] = args ? args.instanceName : undefined;
resourceInputs["modifyType"] = args ? args.modifyType : undefined;
resourceInputs["nodeSpec"] = args ? args.nodeSpec : undefined;
resourceInputs["parameters"] = args ? args.parameters : undefined;
resourceInputs["primaryZoneId"] = args ? args.primaryZoneId : undefined;
resourceInputs["projectName"] = args ? args.projectName : undefined;
resourceInputs["restoreTime"] = args ? args.restoreTime : undefined;
resourceInputs["rollbackTime"] = args ? args.rollbackTime : undefined;
resourceInputs["secondaryZoneId"] = args ? args.secondaryZoneId : undefined;
resourceInputs["srcInstanceId"] = args ? args.srcInstanceId : undefined;
resourceInputs["storageSpace"] = args ? args.storageSpace : undefined;
resourceInputs["subnetId"] = args ? args.subnetId : undefined;
resourceInputs["tags"] = args ? args.tags : undefined;
resourceInputs["zoneMigrations"] = args ? args.zoneMigrations : undefined;
resourceInputs["allowListVersion"] = undefined /*out*/;
resourceInputs["backupUse"] = undefined /*out*/;
resourceInputs["chargeDetails"] = undefined /*out*/;
resourceInputs["createTime"] = undefined /*out*/;
resourceInputs["dataSyncMode"] = undefined /*out*/;
resourceInputs["endpoints"] = undefined /*out*/;
resourceInputs["estimationResults"] = undefined /*out*/;
resourceInputs["instanceId"] = undefined /*out*/;
resourceInputs["instanceStatus"] = undefined /*out*/;
resourceInputs["instanceType"] = undefined /*out*/;
resourceInputs["memory"] = undefined /*out*/;
resourceInputs["nodeNumber"] = undefined /*out*/;
resourceInputs["nodes"] = undefined /*out*/;
resourceInputs["regionId"] = undefined /*out*/;
resourceInputs["storageDataUse"] = undefined /*out*/;
resourceInputs["storageLogUse"] = undefined /*out*/;
resourceInputs["storageTempUse"] = undefined /*out*/;
resourceInputs["storageType"] = undefined /*out*/;
resourceInputs["storageUse"] = undefined /*out*/;
resourceInputs["storageWalUse"] = undefined /*out*/;
resourceInputs["updateTime"] = undefined /*out*/;
resourceInputs["vCpu"] = undefined /*out*/;
resourceInputs["vpcId"] = undefined /*out*/;
resourceInputs["zoneId"] = undefined /*out*/;
resourceInputs["zoneIds"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Instance.__pulumiType, name, resourceInputs, opts);
}
}
exports.Instance = Instance;
/** @internal */
Instance.__pulumiType = 'volcengine:rds_postgresql/instance:Instance';
//# sourceMappingURL=instance.js.map