Alibaba Cloud v3.38.0, Jun 2 23
Alibaba Cloud v3.38.0, Jun 2 23
alicloud.rds.DbNode
Explore with Pulumi AI
Provide RDS cluster instance to increase node resources.
NOTE: Available in 1.202.0+.
Example Usage
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") ?? "tf-testaccrdsdbnodes";
var defaultZones = AliCloud.Rds.GetZones.Invoke(new()
{
Engine = "MySQL",
EngineVersion = "8.0",
InstanceChargeType = "PostPaid",
Category = "cluster",
DbInstanceStorageType = "cloud_essd",
});
var defaultInstanceClasses = AliCloud.Rds.GetInstanceClasses.Invoke(new()
{
ZoneId = defaultZones.Apply(getZonesResult => getZonesResult.Zones[0]?.Id),
Engine = "MySQL",
EngineVersion = "8.0",
Category = "cluster",
DbInstanceStorageType = "cloud_essd",
InstanceChargeType = "PostPaid",
});
var defaultNetworks = AliCloud.Vpc.GetNetworks.Invoke(new()
{
NameRegex = "^default-NODELETING$",
});
var defaultSwitches = AliCloud.Vpc.GetSwitches.Invoke(new()
{
VpcId = defaultNetworks.Apply(getNetworksResult => getNetworksResult.Ids[0]),
ZoneId = defaultZones.Apply(getZonesResult => getZonesResult.Ids[0]),
});
var defaultInstance = new AliCloud.Rds.Instance("defaultInstance", new()
{
Engine = "MySQL",
EngineVersion = "8.0",
DbInstanceStorageType = "cloud_essd",
InstanceType = defaultInstanceClasses.Apply(getInstanceClassesResult => getInstanceClassesResult.InstanceClasses[0]?.InstanceClass),
InstanceStorage = defaultInstanceClasses.Apply(getInstanceClassesResult => getInstanceClassesResult.InstanceClasses[0]?.StorageRange?.Min),
VswitchId = defaultSwitches.Apply(getSwitchesResult => getSwitchesResult.Ids[0]),
InstanceName = name,
ZoneId = defaultZones.Apply(getZonesResult => getZonesResult.Ids[0]),
ZoneIdSlaveA = defaultZones.Apply(getZonesResult => getZonesResult.Ids[0]),
});
var node = new AliCloud.Rds.DbNode("node", new()
{
DbInstanceId = defaultInstance.Id,
ClassCode = defaultInstance.InstanceType,
ZoneId = defaultInstance.ZoneId,
});
});
package main
import (
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/rds"
"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 := "tf-testaccrdsdbnodes"
if param := cfg.Get("name"); param != "" {
name = param
}
defaultZones, err := rds.GetZones(ctx, &rds.GetZonesArgs{
Engine: pulumi.StringRef("MySQL"),
EngineVersion: pulumi.StringRef("8.0"),
InstanceChargeType: pulumi.StringRef("PostPaid"),
Category: pulumi.StringRef("cluster"),
DbInstanceStorageType: pulumi.StringRef("cloud_essd"),
}, nil)
if err != nil {
return err
}
defaultInstanceClasses, err := rds.GetInstanceClasses(ctx, &rds.GetInstanceClassesArgs{
ZoneId: pulumi.StringRef(defaultZones.Zones[0].Id),
Engine: pulumi.StringRef("MySQL"),
EngineVersion: pulumi.StringRef("8.0"),
Category: pulumi.StringRef("cluster"),
DbInstanceStorageType: pulumi.StringRef("cloud_essd"),
InstanceChargeType: pulumi.StringRef("PostPaid"),
}, nil)
if err != nil {
return err
}
defaultNetworks, err := vpc.GetNetworks(ctx, &vpc.GetNetworksArgs{
NameRegex: pulumi.StringRef("^default-NODELETING$"),
}, nil)
if err != nil {
return err
}
defaultSwitches, err := vpc.GetSwitches(ctx, &vpc.GetSwitchesArgs{
VpcId: pulumi.StringRef(defaultNetworks.Ids[0]),
ZoneId: pulumi.StringRef(defaultZones.Ids[0]),
}, nil)
if err != nil {
return err
}
defaultInstance, err := rds.NewInstance(ctx, "defaultInstance", &rds.InstanceArgs{
Engine: pulumi.String("MySQL"),
EngineVersion: pulumi.String("8.0"),
DbInstanceStorageType: pulumi.String("cloud_essd"),
InstanceType: *pulumi.String(defaultInstanceClasses.InstanceClasses[0].InstanceClass),
InstanceStorage: *pulumi.String(defaultInstanceClasses.InstanceClasses[0].StorageRange.Min),
VswitchId: *pulumi.String(defaultSwitches.Ids[0]),
InstanceName: pulumi.String(name),
ZoneId: *pulumi.String(defaultZones.Ids[0]),
ZoneIdSlaveA: *pulumi.String(defaultZones.Ids[0]),
})
if err != nil {
return err
}
_, err = rds.NewDbNode(ctx, "node", &rds.DbNodeArgs{
DbInstanceId: defaultInstance.ID(),
ClassCode: defaultInstance.InstanceType,
ZoneId: defaultInstance.ZoneId,
})
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.rds.RdsFunctions;
import com.pulumi.alicloud.rds.inputs.GetZonesArgs;
import com.pulumi.alicloud.rds.inputs.GetInstanceClassesArgs;
import com.pulumi.alicloud.vpc.VpcFunctions;
import com.pulumi.alicloud.vpc.inputs.GetNetworksArgs;
import com.pulumi.alicloud.vpc.inputs.GetSwitchesArgs;
import com.pulumi.alicloud.rds.Instance;
import com.pulumi.alicloud.rds.InstanceArgs;
import com.pulumi.alicloud.rds.DbNode;
import com.pulumi.alicloud.rds.DbNodeArgs;
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("tf-testaccrdsdbnodes");
final var defaultZones = RdsFunctions.getZones(GetZonesArgs.builder()
.engine("MySQL")
.engineVersion("8.0")
.instanceChargeType("PostPaid")
.category("cluster")
.dbInstanceStorageType("cloud_essd")
.build());
final var defaultInstanceClasses = RdsFunctions.getInstanceClasses(GetInstanceClassesArgs.builder()
.zoneId(defaultZones.applyValue(getZonesResult -> getZonesResult.zones()[0].id()))
.engine("MySQL")
.engineVersion("8.0")
.category("cluster")
.dbInstanceStorageType("cloud_essd")
.instanceChargeType("PostPaid")
.build());
final var defaultNetworks = VpcFunctions.getNetworks(GetNetworksArgs.builder()
.nameRegex("^default-NODELETING$")
.build());
final var defaultSwitches = VpcFunctions.getSwitches(GetSwitchesArgs.builder()
.vpcId(defaultNetworks.applyValue(getNetworksResult -> getNetworksResult.ids()[0]))
.zoneId(defaultZones.applyValue(getZonesResult -> getZonesResult.ids()[0]))
.build());
var defaultInstance = new Instance("defaultInstance", InstanceArgs.builder()
.engine("MySQL")
.engineVersion("8.0")
.dbInstanceStorageType("cloud_essd")
.instanceType(defaultInstanceClasses.applyValue(getInstanceClassesResult -> getInstanceClassesResult.instanceClasses()[0].instanceClass()))
.instanceStorage(defaultInstanceClasses.applyValue(getInstanceClassesResult -> getInstanceClassesResult.instanceClasses()[0].storageRange().min()))
.vswitchId(defaultSwitches.applyValue(getSwitchesResult -> getSwitchesResult.ids()[0]))
.instanceName(name)
.zoneId(defaultZones.applyValue(getZonesResult -> getZonesResult.ids()[0]))
.zoneIdSlaveA(defaultZones.applyValue(getZonesResult -> getZonesResult.ids()[0]))
.build());
var node = new DbNode("node", DbNodeArgs.builder()
.dbInstanceId(defaultInstance.id())
.classCode(defaultInstance.instanceType())
.zoneId(defaultInstance.zoneId())
.build());
}
}
import pulumi
import pulumi_alicloud as alicloud
config = pulumi.Config()
name = config.get("name")
if name is None:
name = "tf-testaccrdsdbnodes"
default_zones = alicloud.rds.get_zones(engine="MySQL",
engine_version="8.0",
instance_charge_type="PostPaid",
category="cluster",
db_instance_storage_type="cloud_essd")
default_instance_classes = alicloud.rds.get_instance_classes(zone_id=default_zones.zones[0].id,
engine="MySQL",
engine_version="8.0",
category="cluster",
db_instance_storage_type="cloud_essd",
instance_charge_type="PostPaid")
default_networks = alicloud.vpc.get_networks(name_regex="^default-NODELETING$")
default_switches = alicloud.vpc.get_switches(vpc_id=default_networks.ids[0],
zone_id=default_zones.ids[0])
default_instance = alicloud.rds.Instance("defaultInstance",
engine="MySQL",
engine_version="8.0",
db_instance_storage_type="cloud_essd",
instance_type=default_instance_classes.instance_classes[0].instance_class,
instance_storage=default_instance_classes.instance_classes[0].storage_range.min,
vswitch_id=default_switches.ids[0],
instance_name=name,
zone_id=default_zones.ids[0],
zone_id_slave_a=default_zones.ids[0])
node = alicloud.rds.DbNode("node",
db_instance_id=default_instance.id,
class_code=default_instance.instance_type,
zone_id=default_instance.zone_id)
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
const config = new pulumi.Config();
const name = config.get("name") || "tf-testaccrdsdbnodes";
const defaultZones = alicloud.rds.getZones({
engine: "MySQL",
engineVersion: "8.0",
instanceChargeType: "PostPaid",
category: "cluster",
dbInstanceStorageType: "cloud_essd",
});
const defaultInstanceClasses = defaultZones.then(defaultZones => alicloud.rds.getInstanceClasses({
zoneId: defaultZones.zones?.[0]?.id,
engine: "MySQL",
engineVersion: "8.0",
category: "cluster",
dbInstanceStorageType: "cloud_essd",
instanceChargeType: "PostPaid",
}));
const defaultNetworks = alicloud.vpc.getNetworks({
nameRegex: "^default-NODELETING$",
});
const defaultSwitches = Promise.all([defaultNetworks, defaultZones]).then(([defaultNetworks, defaultZones]) => alicloud.vpc.getSwitches({
vpcId: defaultNetworks.ids?.[0],
zoneId: defaultZones.ids?.[0],
}));
const defaultInstance = new alicloud.rds.Instance("defaultInstance", {
engine: "MySQL",
engineVersion: "8.0",
dbInstanceStorageType: "cloud_essd",
instanceType: defaultInstanceClasses.then(defaultInstanceClasses => defaultInstanceClasses.instanceClasses?.[0]?.instanceClass),
instanceStorage: defaultInstanceClasses.then(defaultInstanceClasses => defaultInstanceClasses.instanceClasses?.[0]?.storageRange?.min),
vswitchId: defaultSwitches.then(defaultSwitches => defaultSwitches.ids?.[0]),
instanceName: name,
zoneId: defaultZones.then(defaultZones => defaultZones.ids?.[0]),
zoneIdSlaveA: defaultZones.then(defaultZones => defaultZones.ids?.[0]),
});
const node = new alicloud.rds.DbNode("node", {
dbInstanceId: defaultInstance.id,
classCode: defaultInstance.instanceType,
zoneId: defaultInstance.zoneId,
});
configuration:
name:
type: string
default: tf-testaccrdsdbnodes
resources:
defaultInstance:
type: alicloud:rds:Instance
properties:
engine: MySQL
engineVersion: '8.0'
dbInstanceStorageType: cloud_essd
instanceType: ${defaultInstanceClasses.instanceClasses[0].instanceClass}
instanceStorage: ${defaultInstanceClasses.instanceClasses[0].storageRange.min}
vswitchId: ${defaultSwitches.ids[0]}
instanceName: ${name}
zoneId: ${defaultZones.ids[0]}
zoneIdSlaveA: ${defaultZones.ids[0]}
node:
type: alicloud:rds:DbNode
properties:
dbInstanceId: ${defaultInstance.id}
classCode: ${defaultInstance.instanceType}
zoneId: ${defaultInstance.zoneId}
variables:
defaultZones:
fn::invoke:
Function: alicloud:rds:getZones
Arguments:
engine: MySQL
engineVersion: '8.0'
instanceChargeType: PostPaid
category: cluster
dbInstanceStorageType: cloud_essd
defaultInstanceClasses:
fn::invoke:
Function: alicloud:rds:getInstanceClasses
Arguments:
zoneId: ${defaultZones.zones[0].id}
engine: MySQL
engineVersion: '8.0'
category: cluster
dbInstanceStorageType: cloud_essd
instanceChargeType: PostPaid
defaultNetworks:
fn::invoke:
Function: alicloud:vpc:getNetworks
Arguments:
nameRegex: ^default-NODELETING$
defaultSwitches:
fn::invoke:
Function: alicloud:vpc:getSwitches
Arguments:
vpcId: ${defaultNetworks.ids[0]}
zoneId: ${defaultZones.ids[0]}
Create DbNode Resource
new DbNode(name: string, args: DbNodeArgs, opts?: CustomResourceOptions);
@overload
def DbNode(resource_name: str,
opts: Optional[ResourceOptions] = None,
class_code: Optional[str] = None,
db_instance_id: Optional[str] = None,
zone_id: Optional[str] = None)
@overload
def DbNode(resource_name: str,
args: DbNodeArgs,
opts: Optional[ResourceOptions] = None)
func NewDbNode(ctx *Context, name string, args DbNodeArgs, opts ...ResourceOption) (*DbNode, error)
public DbNode(string name, DbNodeArgs args, CustomResourceOptions? opts = null)
public DbNode(String name, DbNodeArgs args)
public DbNode(String name, DbNodeArgs args, CustomResourceOptions options)
type: alicloud:rds:DbNode
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args DbNodeArgs
- 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 DbNodeArgs
- 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 DbNodeArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args DbNodeArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args DbNodeArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
DbNode 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 DbNode resource accepts the following input properties:
- Class
Code string The specification information of the node.
- Db
Instance stringId The Id of instance that can run database.
- Zone
Id string The zone ID of the node.
- Class
Code string The specification information of the node.
- Db
Instance stringId The Id of instance that can run database.
- Zone
Id string The zone ID of the node.
- class
Code String The specification information of the node.
- db
Instance StringId The Id of instance that can run database.
- zone
Id String The zone ID of the node.
- class
Code string The specification information of the node.
- db
Instance stringId The Id of instance that can run database.
- zone
Id string The zone ID of the node.
- class_
code str The specification information of the node.
- db_
instance_ strid The Id of instance that can run database.
- zone_
id str The zone ID of the node.
- class
Code String The specification information of the node.
- db
Instance StringId The Id of instance that can run database.
- zone
Id String The zone ID of the node.
Outputs
All input properties are implicitly available as output properties. Additionally, the DbNode resource produces the following output properties:
- Id string
The provider-assigned unique ID for this managed resource.
- Node
Id string The ID of the node.
- Node
Region stringId The region ID of the node.
- Node
Role string The role of node.
- Id string
The provider-assigned unique ID for this managed resource.
- Node
Id string The ID of the node.
- Node
Region stringId The region ID of the node.
- Node
Role string The role of node.
- id String
The provider-assigned unique ID for this managed resource.
- node
Id String The ID of the node.
- node
Region StringId The region ID of the node.
- node
Role String The role of node.
- id string
The provider-assigned unique ID for this managed resource.
- node
Id string The ID of the node.
- node
Region stringId The region ID of the node.
- node
Role string The role of node.
- id str
The provider-assigned unique ID for this managed resource.
- node_
id str The ID of the node.
- node_
region_ strid The region ID of the node.
- node_
role str The role of node.
- id String
The provider-assigned unique ID for this managed resource.
- node
Id String The ID of the node.
- node
Region StringId The region ID of the node.
- node
Role String The role of node.
Look up Existing DbNode Resource
Get an existing DbNode 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?: DbNodeState, opts?: CustomResourceOptions): DbNode
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
class_code: Optional[str] = None,
db_instance_id: Optional[str] = None,
node_id: Optional[str] = None,
node_region_id: Optional[str] = None,
node_role: Optional[str] = None,
zone_id: Optional[str] = None) -> DbNode
func GetDbNode(ctx *Context, name string, id IDInput, state *DbNodeState, opts ...ResourceOption) (*DbNode, error)
public static DbNode Get(string name, Input<string> id, DbNodeState? state, CustomResourceOptions? opts = null)
public static DbNode get(String name, Output<String> id, DbNodeState 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.
- Class
Code string The specification information of the node.
- Db
Instance stringId The Id of instance that can run database.
- Node
Id string The ID of the node.
- Node
Region stringId The region ID of the node.
- Node
Role string The role of node.
- Zone
Id string The zone ID of the node.
- Class
Code string The specification information of the node.
- Db
Instance stringId The Id of instance that can run database.
- Node
Id string The ID of the node.
- Node
Region stringId The region ID of the node.
- Node
Role string The role of node.
- Zone
Id string The zone ID of the node.
- class
Code String The specification information of the node.
- db
Instance StringId The Id of instance that can run database.
- node
Id String The ID of the node.
- node
Region StringId The region ID of the node.
- node
Role String The role of node.
- zone
Id String The zone ID of the node.
- class
Code string The specification information of the node.
- db
Instance stringId The Id of instance that can run database.
- node
Id string The ID of the node.
- node
Region stringId The region ID of the node.
- node
Role string The role of node.
- zone
Id string The zone ID of the node.
- class_
code str The specification information of the node.
- db_
instance_ strid The Id of instance that can run database.
- node_
id str The ID of the node.
- node_
region_ strid The region ID of the node.
- node_
role str The role of node.
- zone_
id str The zone ID of the node.
- class
Code String The specification information of the node.
- db
Instance StringId The Id of instance that can run database.
- node
Id String The ID of the node.
- node
Region StringId The region ID of the node.
- node
Role String The role of node.
- zone
Id String The zone ID of the node.
Import
RDS MySQL database cluster node agent function can be imported using id, e.g.
$ pulumi import alicloud:rds/dbNode:DbNode example <db_instance_id>:<node_id>
Package Details
- Repository
- Alibaba Cloud pulumi/pulumi-alicloud
- License
- Apache-2.0
- Notes
This Pulumi package is based on the
alicloud
Terraform Provider.