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

volcengine.rds_mysql.InstanceReadonlyNode

Explore with Pulumi AI

Provides a resource to manage rds mysql instance readonly node

Example Usage

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

const fooZones = volcengine.ecs.Zones({});
const fooVpc = new volcengine.vpc.Vpc("fooVpc", {
    vpcName: "acc-test-project1",
    cidrBlock: "172.16.0.0/16",
});
const fooSubnet = new volcengine.vpc.Subnet("fooSubnet", {
    subnetName: "acc-subnet-test-2",
    cidrBlock: "172.16.0.0/24",
    zoneId: fooZones.then(fooZones => fooZones.zones?.[0]?.id),
    vpcId: fooVpc.id,
});
const fooInstance = new volcengine.rds_mysql.Instance("fooInstance", {
    dbEngineVersion: "MySQL_5_7",
    nodeSpec: "rds.mysql.1c2g",
    primaryZoneId: fooZones.then(fooZones => fooZones.zones?.[0]?.id),
    secondaryZoneId: fooZones.then(fooZones => fooZones.zones?.[0]?.id),
    storageSpace: 80,
    subnetId: fooSubnet.id,
    instanceName: "acc-test",
    lowerCaseTableNames: "1",
    chargeInfo: {
        chargeType: "PostPaid",
    },
    parameters: [
        {
            parameterName: "auto_increment_increment",
            parameterValue: "2",
        },
        {
            parameterName: "auto_increment_offset",
            parameterValue: "4",
        },
    ],
});
const fooInstanceReadonlyNode = new volcengine.rds_mysql.InstanceReadonlyNode("fooInstanceReadonlyNode", {
    instanceId: fooInstance.id,
    nodeSpec: "rds.mysql.2c4g",
    zoneId: fooZones.then(fooZones => fooZones.zones?.[0]?.id),
});
Copy
import pulumi
import pulumi_volcengine as volcengine

foo_zones = volcengine.ecs.zones()
foo_vpc = volcengine.vpc.Vpc("fooVpc",
    vpc_name="acc-test-project1",
    cidr_block="172.16.0.0/16")
foo_subnet = volcengine.vpc.Subnet("fooSubnet",
    subnet_name="acc-subnet-test-2",
    cidr_block="172.16.0.0/24",
    zone_id=foo_zones.zones[0].id,
    vpc_id=foo_vpc.id)
foo_instance = volcengine.rds_mysql.Instance("fooInstance",
    db_engine_version="MySQL_5_7",
    node_spec="rds.mysql.1c2g",
    primary_zone_id=foo_zones.zones[0].id,
    secondary_zone_id=foo_zones.zones[0].id,
    storage_space=80,
    subnet_id=foo_subnet.id,
    instance_name="acc-test",
    lower_case_table_names="1",
    charge_info=volcengine.rds_mysql.InstanceChargeInfoArgs(
        charge_type="PostPaid",
    ),
    parameters=[
        volcengine.rds_mysql.InstanceParameterArgs(
            parameter_name="auto_increment_increment",
            parameter_value="2",
        ),
        volcengine.rds_mysql.InstanceParameterArgs(
            parameter_name="auto_increment_offset",
            parameter_value="4",
        ),
    ])
foo_instance_readonly_node = volcengine.rds_mysql.InstanceReadonlyNode("fooInstanceReadonlyNode",
    instance_id=foo_instance.id,
    node_spec="rds.mysql.2c4g",
    zone_id=foo_zones.zones[0].id)
Copy
package main

import (
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
	"github.com/volcengine/pulumi-volcengine/sdk/go/volcengine/ecs"
	"github.com/volcengine/pulumi-volcengine/sdk/go/volcengine/rds_mysql"
	"github.com/volcengine/pulumi-volcengine/sdk/go/volcengine/vpc"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		fooZones, err := ecs.Zones(ctx, nil, nil)
		if err != nil {
			return err
		}
		fooVpc, err := vpc.NewVpc(ctx, "fooVpc", &vpc.VpcArgs{
			VpcName:   pulumi.String("acc-test-project1"),
			CidrBlock: pulumi.String("172.16.0.0/16"),
		})
		if err != nil {
			return err
		}
		fooSubnet, err := vpc.NewSubnet(ctx, "fooSubnet", &vpc.SubnetArgs{
			SubnetName: pulumi.String("acc-subnet-test-2"),
			CidrBlock:  pulumi.String("172.16.0.0/24"),
			ZoneId:     pulumi.String(fooZones.Zones[0].Id),
			VpcId:      fooVpc.ID(),
		})
		if err != nil {
			return err
		}
		fooInstance, err := rds_mysql.NewInstance(ctx, "fooInstance", &rds_mysql.InstanceArgs{
			DbEngineVersion:     pulumi.String("MySQL_5_7"),
			NodeSpec:            pulumi.String("rds.mysql.1c2g"),
			PrimaryZoneId:       pulumi.String(fooZones.Zones[0].Id),
			SecondaryZoneId:     pulumi.String(fooZones.Zones[0].Id),
			StorageSpace:        pulumi.Int(80),
			SubnetId:            fooSubnet.ID(),
			InstanceName:        pulumi.String("acc-test"),
			LowerCaseTableNames: pulumi.String("1"),
			ChargeInfo: &rds_mysql.InstanceChargeInfoArgs{
				ChargeType: pulumi.String("PostPaid"),
			},
			Parameters: rds_mysql.InstanceParameterArray{
				&rds_mysql.InstanceParameterArgs{
					ParameterName:  pulumi.String("auto_increment_increment"),
					ParameterValue: pulumi.String("2"),
				},
				&rds_mysql.InstanceParameterArgs{
					ParameterName:  pulumi.String("auto_increment_offset"),
					ParameterValue: pulumi.String("4"),
				},
			},
		})
		if err != nil {
			return err
		}
		_, err = rds_mysql.NewInstanceReadonlyNode(ctx, "fooInstanceReadonlyNode", &rds_mysql.InstanceReadonlyNodeArgs{
			InstanceId: fooInstance.ID(),
			NodeSpec:   pulumi.String("rds.mysql.2c4g"),
			ZoneId:     pulumi.String(fooZones.Zones[0].Id),
		})
		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 fooZones = Volcengine.Ecs.Zones.Invoke();

    var fooVpc = new Volcengine.Vpc.Vpc("fooVpc", new()
    {
        VpcName = "acc-test-project1",
        CidrBlock = "172.16.0.0/16",
    });

    var fooSubnet = new Volcengine.Vpc.Subnet("fooSubnet", new()
    {
        SubnetName = "acc-subnet-test-2",
        CidrBlock = "172.16.0.0/24",
        ZoneId = fooZones.Apply(zonesResult => zonesResult.Zones[0]?.Id),
        VpcId = fooVpc.Id,
    });

    var fooInstance = new Volcengine.Rds_mysql.Instance("fooInstance", new()
    {
        DbEngineVersion = "MySQL_5_7",
        NodeSpec = "rds.mysql.1c2g",
        PrimaryZoneId = fooZones.Apply(zonesResult => zonesResult.Zones[0]?.Id),
        SecondaryZoneId = fooZones.Apply(zonesResult => zonesResult.Zones[0]?.Id),
        StorageSpace = 80,
        SubnetId = fooSubnet.Id,
        InstanceName = "acc-test",
        LowerCaseTableNames = "1",
        ChargeInfo = new Volcengine.Rds_mysql.Inputs.InstanceChargeInfoArgs
        {
            ChargeType = "PostPaid",
        },
        Parameters = new[]
        {
            new Volcengine.Rds_mysql.Inputs.InstanceParameterArgs
            {
                ParameterName = "auto_increment_increment",
                ParameterValue = "2",
            },
            new Volcengine.Rds_mysql.Inputs.InstanceParameterArgs
            {
                ParameterName = "auto_increment_offset",
                ParameterValue = "4",
            },
        },
    });

    var fooInstanceReadonlyNode = new Volcengine.Rds_mysql.InstanceReadonlyNode("fooInstanceReadonlyNode", new()
    {
        InstanceId = fooInstance.Id,
        NodeSpec = "rds.mysql.2c4g",
        ZoneId = fooZones.Apply(zonesResult => zonesResult.Zones[0]?.Id),
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.volcengine.ecs.EcsFunctions;
import com.pulumi.volcengine.ecs.inputs.ZonesArgs;
import com.pulumi.volcengine.vpc.Vpc;
import com.pulumi.volcengine.vpc.VpcArgs;
import com.pulumi.volcengine.vpc.Subnet;
import com.pulumi.volcengine.vpc.SubnetArgs;
import com.pulumi.volcengine.rds_mysql.Instance;
import com.pulumi.volcengine.rds_mysql.InstanceArgs;
import com.pulumi.volcengine.rds_mysql.inputs.InstanceChargeInfoArgs;
import com.pulumi.volcengine.rds_mysql.inputs.InstanceParameterArgs;
import com.pulumi.volcengine.rds_mysql.InstanceReadonlyNode;
import com.pulumi.volcengine.rds_mysql.InstanceReadonlyNodeArgs;
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 fooZones = EcsFunctions.Zones();

        var fooVpc = new Vpc("fooVpc", VpcArgs.builder()        
            .vpcName("acc-test-project1")
            .cidrBlock("172.16.0.0/16")
            .build());

        var fooSubnet = new Subnet("fooSubnet", SubnetArgs.builder()        
            .subnetName("acc-subnet-test-2")
            .cidrBlock("172.16.0.0/24")
            .zoneId(fooZones.applyValue(zonesResult -> zonesResult.zones()[0].id()))
            .vpcId(fooVpc.id())
            .build());

        var fooInstance = new Instance("fooInstance", InstanceArgs.builder()        
            .dbEngineVersion("MySQL_5_7")
            .nodeSpec("rds.mysql.1c2g")
            .primaryZoneId(fooZones.applyValue(zonesResult -> zonesResult.zones()[0].id()))
            .secondaryZoneId(fooZones.applyValue(zonesResult -> zonesResult.zones()[0].id()))
            .storageSpace(80)
            .subnetId(fooSubnet.id())
            .instanceName("acc-test")
            .lowerCaseTableNames("1")
            .chargeInfo(InstanceChargeInfoArgs.builder()
                .chargeType("PostPaid")
                .build())
            .parameters(            
                InstanceParameterArgs.builder()
                    .parameterName("auto_increment_increment")
                    .parameterValue("2")
                    .build(),
                InstanceParameterArgs.builder()
                    .parameterName("auto_increment_offset")
                    .parameterValue("4")
                    .build())
            .build());

        var fooInstanceReadonlyNode = new InstanceReadonlyNode("fooInstanceReadonlyNode", InstanceReadonlyNodeArgs.builder()        
            .instanceId(fooInstance.id())
            .nodeSpec("rds.mysql.2c4g")
            .zoneId(fooZones.applyValue(zonesResult -> zonesResult.zones()[0].id()))
            .build());

    }
}
Copy
resources:
  fooVpc:
    type: volcengine:vpc:Vpc
    properties:
      vpcName: acc-test-project1
      cidrBlock: 172.16.0.0/16
  fooSubnet:
    type: volcengine:vpc:Subnet
    properties:
      subnetName: acc-subnet-test-2
      cidrBlock: 172.16.0.0/24
      zoneId: ${fooZones.zones[0].id}
      vpcId: ${fooVpc.id}
  fooInstance:
    type: volcengine:rds_mysql:Instance
    properties:
      dbEngineVersion: MySQL_5_7
      nodeSpec: rds.mysql.1c2g
      primaryZoneId: ${fooZones.zones[0].id}
      secondaryZoneId: ${fooZones.zones[0].id}
      storageSpace: 80
      subnetId: ${fooSubnet.id}
      instanceName: acc-test
      lowerCaseTableNames: '1'
      chargeInfo:
        chargeType: PostPaid
      parameters:
        - parameterName: auto_increment_increment
          parameterValue: '2'
        - parameterName: auto_increment_offset
          parameterValue: '4'
  fooInstanceReadonlyNode:
    type: volcengine:rds_mysql:InstanceReadonlyNode
    properties:
      instanceId: ${fooInstance.id}
      nodeSpec: rds.mysql.2c4g
      zoneId: ${fooZones.zones[0].id}
variables:
  fooZones:
    fn::invoke:
      Function: volcengine:ecs:Zones
      Arguments: {}
Copy

Create InstanceReadonlyNode Resource

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

Constructor syntax

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

@overload
def InstanceReadonlyNode(resource_name: str,
                         opts: Optional[ResourceOptions] = None,
                         instance_id: Optional[str] = None,
                         node_spec: Optional[str] = None,
                         zone_id: Optional[str] = None)
func NewInstanceReadonlyNode(ctx *Context, name string, args InstanceReadonlyNodeArgs, opts ...ResourceOption) (*InstanceReadonlyNode, error)
public InstanceReadonlyNode(string name, InstanceReadonlyNodeArgs args, CustomResourceOptions? opts = null)
public InstanceReadonlyNode(String name, InstanceReadonlyNodeArgs args)
public InstanceReadonlyNode(String name, InstanceReadonlyNodeArgs args, CustomResourceOptions options)
type: volcengine:rds_mysql:InstanceReadonlyNode
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. InstanceReadonlyNodeArgs
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. InstanceReadonlyNodeArgs
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. InstanceReadonlyNodeArgs
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. InstanceReadonlyNodeArgs
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. InstanceReadonlyNodeArgs
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 instanceReadonlyNodeResource = new Volcengine.Rds_mysql.InstanceReadonlyNode("instanceReadonlyNodeResource", new()
{
    InstanceId = "string",
    NodeSpec = "string",
    ZoneId = "string",
});
Copy
example, err := rds_mysql.NewInstanceReadonlyNode(ctx, "instanceReadonlyNodeResource", &rds_mysql.InstanceReadonlyNodeArgs{
	InstanceId: pulumi.String("string"),
	NodeSpec:   pulumi.String("string"),
	ZoneId:     pulumi.String("string"),
})
Copy
var instanceReadonlyNodeResource = new InstanceReadonlyNode("instanceReadonlyNodeResource", InstanceReadonlyNodeArgs.builder()
    .instanceId("string")
    .nodeSpec("string")
    .zoneId("string")
    .build());
Copy
instance_readonly_node_resource = volcengine.rds_mysql.InstanceReadonlyNode("instanceReadonlyNodeResource",
    instance_id="string",
    node_spec="string",
    zone_id="string")
Copy
const instanceReadonlyNodeResource = new volcengine.rds_mysql.InstanceReadonlyNode("instanceReadonlyNodeResource", {
    instanceId: "string",
    nodeSpec: "string",
    zoneId: "string",
});
Copy
type: volcengine:rds_mysql:InstanceReadonlyNode
properties:
    instanceId: string
    nodeSpec: string
    zoneId: string
Copy

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

InstanceId
This property is required.
Changes to this property will trigger replacement.
string
The RDS mysql instance id of the readonly node.
NodeSpec This property is required. string
The specification of readonly node.
ZoneId
This property is required.
Changes to this property will trigger replacement.
string
The available zone of readonly node.
InstanceId
This property is required.
Changes to this property will trigger replacement.
string
The RDS mysql instance id of the readonly node.
NodeSpec This property is required. string
The specification of readonly node.
ZoneId
This property is required.
Changes to this property will trigger replacement.
string
The available zone of readonly node.
instanceId
This property is required.
Changes to this property will trigger replacement.
String
The RDS mysql instance id of the readonly node.
nodeSpec This property is required. String
The specification of readonly node.
zoneId
This property is required.
Changes to this property will trigger replacement.
String
The available zone of readonly node.
instanceId
This property is required.
Changes to this property will trigger replacement.
string
The RDS mysql instance id of the readonly node.
nodeSpec This property is required. string
The specification of readonly node.
zoneId
This property is required.
Changes to this property will trigger replacement.
string
The available zone of readonly node.
instance_id
This property is required.
Changes to this property will trigger replacement.
str
The RDS mysql instance id of the readonly node.
node_spec This property is required. str
The specification of readonly node.
zone_id
This property is required.
Changes to this property will trigger replacement.
str
The available zone of readonly node.
instanceId
This property is required.
Changes to this property will trigger replacement.
String
The RDS mysql instance id of the readonly node.
nodeSpec This property is required. String
The specification of readonly node.
zoneId
This property is required.
Changes to this property will trigger replacement.
String
The available zone of readonly node.

Outputs

All input properties are implicitly available as output properties. Additionally, the InstanceReadonlyNode resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
NodeId string
The id of the readonly node.
Id string
The provider-assigned unique ID for this managed resource.
NodeId string
The id of the readonly node.
id String
The provider-assigned unique ID for this managed resource.
nodeId String
The id of the readonly node.
id string
The provider-assigned unique ID for this managed resource.
nodeId string
The id of the readonly node.
id str
The provider-assigned unique ID for this managed resource.
node_id str
The id of the readonly node.
id String
The provider-assigned unique ID for this managed resource.
nodeId String
The id of the readonly node.

Look up Existing InstanceReadonlyNode Resource

Get an existing InstanceReadonlyNode 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?: InstanceReadonlyNodeState, opts?: CustomResourceOptions): InstanceReadonlyNode
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        instance_id: Optional[str] = None,
        node_id: Optional[str] = None,
        node_spec: Optional[str] = None,
        zone_id: Optional[str] = None) -> InstanceReadonlyNode
func GetInstanceReadonlyNode(ctx *Context, name string, id IDInput, state *InstanceReadonlyNodeState, opts ...ResourceOption) (*InstanceReadonlyNode, error)
public static InstanceReadonlyNode Get(string name, Input<string> id, InstanceReadonlyNodeState? state, CustomResourceOptions? opts = null)
public static InstanceReadonlyNode get(String name, Output<String> id, InstanceReadonlyNodeState state, CustomResourceOptions options)
resources:  _:    type: volcengine:rds_mysql:InstanceReadonlyNode    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:
InstanceId Changes to this property will trigger replacement. string
The RDS mysql instance id of the readonly node.
NodeId string
The id of the readonly node.
NodeSpec string
The specification of readonly node.
ZoneId Changes to this property will trigger replacement. string
The available zone of readonly node.
InstanceId Changes to this property will trigger replacement. string
The RDS mysql instance id of the readonly node.
NodeId string
The id of the readonly node.
NodeSpec string
The specification of readonly node.
ZoneId Changes to this property will trigger replacement. string
The available zone of readonly node.
instanceId Changes to this property will trigger replacement. String
The RDS mysql instance id of the readonly node.
nodeId String
The id of the readonly node.
nodeSpec String
The specification of readonly node.
zoneId Changes to this property will trigger replacement. String
The available zone of readonly node.
instanceId Changes to this property will trigger replacement. string
The RDS mysql instance id of the readonly node.
nodeId string
The id of the readonly node.
nodeSpec string
The specification of readonly node.
zoneId Changes to this property will trigger replacement. string
The available zone of readonly node.
instance_id Changes to this property will trigger replacement. str
The RDS mysql instance id of the readonly node.
node_id str
The id of the readonly node.
node_spec str
The specification of readonly node.
zone_id Changes to this property will trigger replacement. str
The available zone of readonly node.
instanceId Changes to this property will trigger replacement. String
The RDS mysql instance id of the readonly node.
nodeId String
The id of the readonly node.
nodeSpec String
The specification of readonly node.
zoneId Changes to this property will trigger replacement. String
The available zone of readonly node.

Import

Rds Mysql Instance Readonly Node can be imported using the instance_id:node_id, e.g.

$ pulumi import volcengine:rds_mysql/instanceReadonlyNode:InstanceReadonlyNode default mysql-72da4258c2c7:mysql-72da4258c2c7-r7f93
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.