1. Packages
  2. Tencentcloud Provider
  3. API Docs
  4. PostgresqlReadonlyInstance
tencentcloud 1.81.183 published on Wednesday, Apr 16, 2025 by tencentcloudstack

tencentcloud.PostgresqlReadonlyInstance

Explore with Pulumi AI

Use this resource to create postgresql readonly instance.

Example Usage

Create postgresql readonly instance

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

const config = new pulumi.Config();
const availabilityZone = config.get("availabilityZone") || "ap-guangzhou-3";
// create vpc
const vpc = new tencentcloud.Vpc("vpc", {cidrBlock: "10.0.0.0/16"});
// create vpc subnet
const subnet = new tencentcloud.Subnet("subnet", {
    availabilityZone: availabilityZone,
    vpcId: vpc.vpcId,
    cidrBlock: "10.0.20.0/28",
    isMulticast: false,
});
// create postgresql
const examplePostgresqlInstance = new tencentcloud.PostgresqlInstance("examplePostgresqlInstance", {
    availabilityZone: availabilityZone,
    chargeType: "POSTPAID_BY_HOUR",
    vpcId: vpc.vpcId,
    subnetId: subnet.subnetId,
    dbMajorVersion: "10",
    rootUser: "root123",
    rootPassword: "Root123$",
    charset: "UTF8",
    projectId: 0,
    memory: 2,
    cpu: 1,
    storage: 10,
    tags: {
        test: "tf",
    },
});
// create postgresql readonly group
const examplePostgresqlReadonlyGroup = new tencentcloud.PostgresqlReadonlyGroup("examplePostgresqlReadonlyGroup", {
    masterDbInstanceId: examplePostgresqlInstance.postgresqlInstanceId,
    projectId: 0,
    vpcId: vpc.vpcId,
    subnetId: subnet.subnetId,
    replayLagEliminate: 1,
    replayLatencyEliminate: 1,
    maxReplayLag: 100,
    maxReplayLatency: 512,
    minDelayEliminateReserve: 1,
});
// create security group
const exampleSecurityGroup = new tencentcloud.SecurityGroup("exampleSecurityGroup", {
    description: "sg desc.",
    projectId: 0,
    tags: {
        example: "test",
    },
});
// create postgresql readonly instance
const examplePostgresqlReadonlyInstance = new tencentcloud.PostgresqlReadonlyInstance("examplePostgresqlReadonlyInstance", {
    readOnlyGroupId: examplePostgresqlReadonlyGroup.postgresqlReadonlyGroupId,
    masterDbInstanceId: examplePostgresqlInstance.postgresqlInstanceId,
    zone: availabilityZone,
    autoRenewFlag: 0,
    dbVersion: "10.23",
    instanceChargeType: "POSTPAID_BY_HOUR",
    memory: 4,
    cpu: 2,
    storage: 250,
    vpcId: vpc.vpcId,
    subnetId: subnet.subnetId,
    needSupportIpv6: 0,
    projectId: 0,
    securityGroupsIds: [exampleSecurityGroup.securityGroupId],
});
Copy
import pulumi
import pulumi_tencentcloud as tencentcloud

config = pulumi.Config()
availability_zone = config.get("availabilityZone")
if availability_zone is None:
    availability_zone = "ap-guangzhou-3"
# create vpc
vpc = tencentcloud.Vpc("vpc", cidr_block="10.0.0.0/16")
# create vpc subnet
subnet = tencentcloud.Subnet("subnet",
    availability_zone=availability_zone,
    vpc_id=vpc.vpc_id,
    cidr_block="10.0.20.0/28",
    is_multicast=False)
# create postgresql
example_postgresql_instance = tencentcloud.PostgresqlInstance("examplePostgresqlInstance",
    availability_zone=availability_zone,
    charge_type="POSTPAID_BY_HOUR",
    vpc_id=vpc.vpc_id,
    subnet_id=subnet.subnet_id,
    db_major_version="10",
    root_user="root123",
    root_password="Root123$",
    charset="UTF8",
    project_id=0,
    memory=2,
    cpu=1,
    storage=10,
    tags={
        "test": "tf",
    })
# create postgresql readonly group
example_postgresql_readonly_group = tencentcloud.PostgresqlReadonlyGroup("examplePostgresqlReadonlyGroup",
    master_db_instance_id=example_postgresql_instance.postgresql_instance_id,
    project_id=0,
    vpc_id=vpc.vpc_id,
    subnet_id=subnet.subnet_id,
    replay_lag_eliminate=1,
    replay_latency_eliminate=1,
    max_replay_lag=100,
    max_replay_latency=512,
    min_delay_eliminate_reserve=1)
# create security group
example_security_group = tencentcloud.SecurityGroup("exampleSecurityGroup",
    description="sg desc.",
    project_id=0,
    tags={
        "example": "test",
    })
# create postgresql readonly instance
example_postgresql_readonly_instance = tencentcloud.PostgresqlReadonlyInstance("examplePostgresqlReadonlyInstance",
    read_only_group_id=example_postgresql_readonly_group.postgresql_readonly_group_id,
    master_db_instance_id=example_postgresql_instance.postgresql_instance_id,
    zone=availability_zone,
    auto_renew_flag=0,
    db_version="10.23",
    instance_charge_type="POSTPAID_BY_HOUR",
    memory=4,
    cpu=2,
    storage=250,
    vpc_id=vpc.vpc_id,
    subnet_id=subnet.subnet_id,
    need_support_ipv6=0,
    project_id=0,
    security_groups_ids=[example_security_group.security_group_id])
Copy
package main

import (
	"github.com/pulumi/pulumi-terraform-provider/sdks/go/tencentcloud/tencentcloud"
	"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, "")
		availabilityZone := "ap-guangzhou-3"
		if param := cfg.Get("availabilityZone"); param != "" {
			availabilityZone = param
		}
		// create vpc
		vpc, err := tencentcloud.NewVpc(ctx, "vpc", &tencentcloud.VpcArgs{
			CidrBlock: pulumi.String("10.0.0.0/16"),
		})
		if err != nil {
			return err
		}
		// create vpc subnet
		subnet, err := tencentcloud.NewSubnet(ctx, "subnet", &tencentcloud.SubnetArgs{
			AvailabilityZone: pulumi.String(availabilityZone),
			VpcId:            vpc.VpcId,
			CidrBlock:        pulumi.String("10.0.20.0/28"),
			IsMulticast:      pulumi.Bool(false),
		})
		if err != nil {
			return err
		}
		// create postgresql
		examplePostgresqlInstance, err := tencentcloud.NewPostgresqlInstance(ctx, "examplePostgresqlInstance", &tencentcloud.PostgresqlInstanceArgs{
			AvailabilityZone: pulumi.String(availabilityZone),
			ChargeType:       pulumi.String("POSTPAID_BY_HOUR"),
			VpcId:            vpc.VpcId,
			SubnetId:         subnet.SubnetId,
			DbMajorVersion:   pulumi.String("10"),
			RootUser:         pulumi.String("root123"),
			RootPassword:     pulumi.String("Root123$"),
			Charset:          pulumi.String("UTF8"),
			ProjectId:        pulumi.Float64(0),
			Memory:           pulumi.Float64(2),
			Cpu:              pulumi.Float64(1),
			Storage:          pulumi.Float64(10),
			Tags: pulumi.StringMap{
				"test": pulumi.String("tf"),
			},
		})
		if err != nil {
			return err
		}
		// create postgresql readonly group
		examplePostgresqlReadonlyGroup, err := tencentcloud.NewPostgresqlReadonlyGroup(ctx, "examplePostgresqlReadonlyGroup", &tencentcloud.PostgresqlReadonlyGroupArgs{
			MasterDbInstanceId:       examplePostgresqlInstance.PostgresqlInstanceId,
			ProjectId:                pulumi.Float64(0),
			VpcId:                    vpc.VpcId,
			SubnetId:                 subnet.SubnetId,
			ReplayLagEliminate:       pulumi.Float64(1),
			ReplayLatencyEliminate:   pulumi.Float64(1),
			MaxReplayLag:             pulumi.Float64(100),
			MaxReplayLatency:         pulumi.Float64(512),
			MinDelayEliminateReserve: pulumi.Float64(1),
		})
		if err != nil {
			return err
		}
		// create security group
		exampleSecurityGroup, err := tencentcloud.NewSecurityGroup(ctx, "exampleSecurityGroup", &tencentcloud.SecurityGroupArgs{
			Description: pulumi.String("sg desc."),
			ProjectId:   pulumi.Float64(0),
			Tags: pulumi.StringMap{
				"example": pulumi.String("test"),
			},
		})
		if err != nil {
			return err
		}
		// create postgresql readonly instance
		_, err = tencentcloud.NewPostgresqlReadonlyInstance(ctx, "examplePostgresqlReadonlyInstance", &tencentcloud.PostgresqlReadonlyInstanceArgs{
			ReadOnlyGroupId:    examplePostgresqlReadonlyGroup.PostgresqlReadonlyGroupId,
			MasterDbInstanceId: examplePostgresqlInstance.PostgresqlInstanceId,
			Zone:               pulumi.String(availabilityZone),
			AutoRenewFlag:      pulumi.Float64(0),
			DbVersion:          pulumi.String("10.23"),
			InstanceChargeType: pulumi.String("POSTPAID_BY_HOUR"),
			Memory:             pulumi.Float64(4),
			Cpu:                pulumi.Float64(2),
			Storage:            pulumi.Float64(250),
			VpcId:              vpc.VpcId,
			SubnetId:           subnet.SubnetId,
			NeedSupportIpv6:    pulumi.Float64(0),
			ProjectId:          pulumi.Float64(0),
			SecurityGroupsIds: pulumi.StringArray{
				exampleSecurityGroup.SecurityGroupId,
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Tencentcloud = Pulumi.Tencentcloud;

return await Deployment.RunAsync(() => 
{
    var config = new Config();
    var availabilityZone = config.Get("availabilityZone") ?? "ap-guangzhou-3";
    // create vpc
    var vpc = new Tencentcloud.Vpc("vpc", new()
    {
        CidrBlock = "10.0.0.0/16",
    });

    // create vpc subnet
    var subnet = new Tencentcloud.Subnet("subnet", new()
    {
        AvailabilityZone = availabilityZone,
        VpcId = vpc.VpcId,
        CidrBlock = "10.0.20.0/28",
        IsMulticast = false,
    });

    // create postgresql
    var examplePostgresqlInstance = new Tencentcloud.PostgresqlInstance("examplePostgresqlInstance", new()
    {
        AvailabilityZone = availabilityZone,
        ChargeType = "POSTPAID_BY_HOUR",
        VpcId = vpc.VpcId,
        SubnetId = subnet.SubnetId,
        DbMajorVersion = "10",
        RootUser = "root123",
        RootPassword = "Root123$",
        Charset = "UTF8",
        ProjectId = 0,
        Memory = 2,
        Cpu = 1,
        Storage = 10,
        Tags = 
        {
            { "test", "tf" },
        },
    });

    // create postgresql readonly group
    var examplePostgresqlReadonlyGroup = new Tencentcloud.PostgresqlReadonlyGroup("examplePostgresqlReadonlyGroup", new()
    {
        MasterDbInstanceId = examplePostgresqlInstance.PostgresqlInstanceId,
        ProjectId = 0,
        VpcId = vpc.VpcId,
        SubnetId = subnet.SubnetId,
        ReplayLagEliminate = 1,
        ReplayLatencyEliminate = 1,
        MaxReplayLag = 100,
        MaxReplayLatency = 512,
        MinDelayEliminateReserve = 1,
    });

    // create security group
    var exampleSecurityGroup = new Tencentcloud.SecurityGroup("exampleSecurityGroup", new()
    {
        Description = "sg desc.",
        ProjectId = 0,
        Tags = 
        {
            { "example", "test" },
        },
    });

    // create postgresql readonly instance
    var examplePostgresqlReadonlyInstance = new Tencentcloud.PostgresqlReadonlyInstance("examplePostgresqlReadonlyInstance", new()
    {
        ReadOnlyGroupId = examplePostgresqlReadonlyGroup.PostgresqlReadonlyGroupId,
        MasterDbInstanceId = examplePostgresqlInstance.PostgresqlInstanceId,
        Zone = availabilityZone,
        AutoRenewFlag = 0,
        DbVersion = "10.23",
        InstanceChargeType = "POSTPAID_BY_HOUR",
        Memory = 4,
        Cpu = 2,
        Storage = 250,
        VpcId = vpc.VpcId,
        SubnetId = subnet.SubnetId,
        NeedSupportIpv6 = 0,
        ProjectId = 0,
        SecurityGroupsIds = new[]
        {
            exampleSecurityGroup.SecurityGroupId,
        },
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.tencentcloud.Vpc;
import com.pulumi.tencentcloud.VpcArgs;
import com.pulumi.tencentcloud.Subnet;
import com.pulumi.tencentcloud.SubnetArgs;
import com.pulumi.tencentcloud.PostgresqlInstance;
import com.pulumi.tencentcloud.PostgresqlInstanceArgs;
import com.pulumi.tencentcloud.PostgresqlReadonlyGroup;
import com.pulumi.tencentcloud.PostgresqlReadonlyGroupArgs;
import com.pulumi.tencentcloud.SecurityGroup;
import com.pulumi.tencentcloud.SecurityGroupArgs;
import com.pulumi.tencentcloud.PostgresqlReadonlyInstance;
import com.pulumi.tencentcloud.PostgresqlReadonlyInstanceArgs;
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 availabilityZone = config.get("availabilityZone").orElse("ap-guangzhou-3");
        // create vpc
        var vpc = new Vpc("vpc", VpcArgs.builder()
            .cidrBlock("10.0.0.0/16")
            .build());

        // create vpc subnet
        var subnet = new Subnet("subnet", SubnetArgs.builder()
            .availabilityZone(availabilityZone)
            .vpcId(vpc.vpcId())
            .cidrBlock("10.0.20.0/28")
            .isMulticast(false)
            .build());

        // create postgresql
        var examplePostgresqlInstance = new PostgresqlInstance("examplePostgresqlInstance", PostgresqlInstanceArgs.builder()
            .availabilityZone(availabilityZone)
            .chargeType("POSTPAID_BY_HOUR")
            .vpcId(vpc.vpcId())
            .subnetId(subnet.subnetId())
            .dbMajorVersion("10")
            .rootUser("root123")
            .rootPassword("Root123$")
            .charset("UTF8")
            .projectId(0)
            .memory(2)
            .cpu(1)
            .storage(10)
            .tags(Map.of("test", "tf"))
            .build());

        // create postgresql readonly group
        var examplePostgresqlReadonlyGroup = new PostgresqlReadonlyGroup("examplePostgresqlReadonlyGroup", PostgresqlReadonlyGroupArgs.builder()
            .masterDbInstanceId(examplePostgresqlInstance.postgresqlInstanceId())
            .projectId(0)
            .vpcId(vpc.vpcId())
            .subnetId(subnet.subnetId())
            .replayLagEliminate(1)
            .replayLatencyEliminate(1)
            .maxReplayLag(100)
            .maxReplayLatency(512)
            .minDelayEliminateReserve(1)
            .build());

        // create security group
        var exampleSecurityGroup = new SecurityGroup("exampleSecurityGroup", SecurityGroupArgs.builder()
            .description("sg desc.")
            .projectId(0)
            .tags(Map.of("example", "test"))
            .build());

        // create postgresql readonly instance
        var examplePostgresqlReadonlyInstance = new PostgresqlReadonlyInstance("examplePostgresqlReadonlyInstance", PostgresqlReadonlyInstanceArgs.builder()
            .readOnlyGroupId(examplePostgresqlReadonlyGroup.postgresqlReadonlyGroupId())
            .masterDbInstanceId(examplePostgresqlInstance.postgresqlInstanceId())
            .zone(availabilityZone)
            .autoRenewFlag(0)
            .dbVersion("10.23")
            .instanceChargeType("POSTPAID_BY_HOUR")
            .memory(4)
            .cpu(2)
            .storage(250)
            .vpcId(vpc.vpcId())
            .subnetId(subnet.subnetId())
            .needSupportIpv6(0)
            .projectId(0)
            .securityGroupsIds(exampleSecurityGroup.securityGroupId())
            .build());

    }
}
Copy
configuration:
  availabilityZone:
    type: string
    default: ap-guangzhou-3
resources:
  # create vpc
  vpc:
    type: tencentcloud:Vpc
    properties:
      cidrBlock: 10.0.0.0/16
  # create vpc subnet
  subnet:
    type: tencentcloud:Subnet
    properties:
      availabilityZone: ${availabilityZone}
      vpcId: ${vpc.vpcId}
      cidrBlock: 10.0.20.0/28
      isMulticast: false
  # create postgresql
  examplePostgresqlInstance:
    type: tencentcloud:PostgresqlInstance
    properties:
      availabilityZone: ${availabilityZone}
      chargeType: POSTPAID_BY_HOUR
      vpcId: ${vpc.vpcId}
      subnetId: ${subnet.subnetId}
      dbMajorVersion: '10'
      rootUser: root123
      rootPassword: Root123$
      charset: UTF8
      projectId: 0
      memory: 2
      cpu: 1
      storage: 10
      tags:
        test: tf
  # create postgresql readonly group
  examplePostgresqlReadonlyGroup:
    type: tencentcloud:PostgresqlReadonlyGroup
    properties:
      masterDbInstanceId: ${examplePostgresqlInstance.postgresqlInstanceId}
      projectId: 0
      vpcId: ${vpc.vpcId}
      subnetId: ${subnet.subnetId}
      replayLagEliminate: 1
      replayLatencyEliminate: 1
      maxReplayLag: 100
      maxReplayLatency: 512
      minDelayEliminateReserve: 1
  # create security group
  exampleSecurityGroup:
    type: tencentcloud:SecurityGroup
    properties:
      description: sg desc.
      projectId: 0
      tags:
        example: test
  # create postgresql readonly instance
  examplePostgresqlReadonlyInstance:
    type: tencentcloud:PostgresqlReadonlyInstance
    properties:
      readOnlyGroupId: ${examplePostgresqlReadonlyGroup.postgresqlReadonlyGroupId}
      masterDbInstanceId: ${examplePostgresqlInstance.postgresqlInstanceId}
      zone: ${availabilityZone}
      autoRenewFlag: 0
      dbVersion: '10.23'
      instanceChargeType: POSTPAID_BY_HOUR
      memory: 4
      cpu: 2
      storage: 250
      vpcId: ${vpc.vpcId}
      subnetId: ${subnet.subnetId}
      needSupportIpv6: 0
      projectId: 0
      securityGroupsIds:
        - ${exampleSecurityGroup.securityGroupId}
Copy

Create postgresql readonly instance of CDC

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

const config = new pulumi.Config();
const availabilityZone = config.get("availabilityZone") || "ap-guangzhou-4";
// create vpc
const vpc = new tencentcloud.Vpc("vpc", {cidrBlock: "10.0.0.0/16"});
// create vpc subnet
const subnet = new tencentcloud.Subnet("subnet", {
    availabilityZone: availabilityZone,
    vpcId: vpc.vpcId,
    cidrBlock: "10.0.20.0/28",
    isMulticast: false,
});
// create postgresql
const examplePostgresqlInstance = new tencentcloud.PostgresqlInstance("examplePostgresqlInstance", {
    availabilityZone: availabilityZone,
    chargeType: "POSTPAID_BY_HOUR",
    vpcId: vpc.vpcId,
    subnetId: subnet.subnetId,
    dbMajorVersion: "10",
    rootUser: "root123",
    rootPassword: "Root123$",
    charset: "UTF8",
    projectId: 0,
    memory: 2,
    cpu: 1,
    storage: 10,
    dbNodeSets: [
        {
            role: "Primary",
            zone: availabilityZone,
            dedicatedClusterId: "cluster-262n63e8",
        },
        {
            zone: availabilityZone,
            dedicatedClusterId: "cluster-262n63e8",
        },
    ],
    tags: {
        CreateBy: "terraform",
    },
});
// create postgresql readonly group
const examplePostgresqlReadonlyGroup = new tencentcloud.PostgresqlReadonlyGroup("examplePostgresqlReadonlyGroup", {
    masterDbInstanceId: examplePostgresqlInstance.postgresqlInstanceId,
    projectId: 0,
    vpcId: vpc.vpcId,
    subnetId: subnet.subnetId,
    replayLagEliminate: 1,
    replayLatencyEliminate: 1,
    maxReplayLag: 100,
    maxReplayLatency: 512,
    minDelayEliminateReserve: 1,
});
// create security group
const exampleSecurityGroup = new tencentcloud.SecurityGroup("exampleSecurityGroup", {
    description: "sg desc.",
    projectId: 0,
    tags: {
        CreateBy: "terraform",
    },
});
// create postgresql readonly instance
const examplePostgresqlReadonlyInstance = new tencentcloud.PostgresqlReadonlyInstance("examplePostgresqlReadonlyInstance", {
    readOnlyGroupId: examplePostgresqlReadonlyGroup.postgresqlReadonlyGroupId,
    masterDbInstanceId: examplePostgresqlInstance.postgresqlInstanceId,
    zone: availabilityZone,
    autoRenewFlag: 0,
    dbVersion: "10.23",
    instanceChargeType: "POSTPAID_BY_HOUR",
    memory: 4,
    cpu: 2,
    storage: 250,
    vpcId: vpc.vpcId,
    subnetId: subnet.subnetId,
    needSupportIpv6: 0,
    projectId: 0,
    dedicatedClusterId: "cluster-262n63e8",
    securityGroupsIds: [exampleSecurityGroup.securityGroupId],
});
Copy
import pulumi
import pulumi_tencentcloud as tencentcloud

config = pulumi.Config()
availability_zone = config.get("availabilityZone")
if availability_zone is None:
    availability_zone = "ap-guangzhou-4"
# create vpc
vpc = tencentcloud.Vpc("vpc", cidr_block="10.0.0.0/16")
# create vpc subnet
subnet = tencentcloud.Subnet("subnet",
    availability_zone=availability_zone,
    vpc_id=vpc.vpc_id,
    cidr_block="10.0.20.0/28",
    is_multicast=False)
# create postgresql
example_postgresql_instance = tencentcloud.PostgresqlInstance("examplePostgresqlInstance",
    availability_zone=availability_zone,
    charge_type="POSTPAID_BY_HOUR",
    vpc_id=vpc.vpc_id,
    subnet_id=subnet.subnet_id,
    db_major_version="10",
    root_user="root123",
    root_password="Root123$",
    charset="UTF8",
    project_id=0,
    memory=2,
    cpu=1,
    storage=10,
    db_node_sets=[
        {
            "role": "Primary",
            "zone": availability_zone,
            "dedicated_cluster_id": "cluster-262n63e8",
        },
        {
            "zone": availability_zone,
            "dedicated_cluster_id": "cluster-262n63e8",
        },
    ],
    tags={
        "CreateBy": "terraform",
    })
# create postgresql readonly group
example_postgresql_readonly_group = tencentcloud.PostgresqlReadonlyGroup("examplePostgresqlReadonlyGroup",
    master_db_instance_id=example_postgresql_instance.postgresql_instance_id,
    project_id=0,
    vpc_id=vpc.vpc_id,
    subnet_id=subnet.subnet_id,
    replay_lag_eliminate=1,
    replay_latency_eliminate=1,
    max_replay_lag=100,
    max_replay_latency=512,
    min_delay_eliminate_reserve=1)
# create security group
example_security_group = tencentcloud.SecurityGroup("exampleSecurityGroup",
    description="sg desc.",
    project_id=0,
    tags={
        "CreateBy": "terraform",
    })
# create postgresql readonly instance
example_postgresql_readonly_instance = tencentcloud.PostgresqlReadonlyInstance("examplePostgresqlReadonlyInstance",
    read_only_group_id=example_postgresql_readonly_group.postgresql_readonly_group_id,
    master_db_instance_id=example_postgresql_instance.postgresql_instance_id,
    zone=availability_zone,
    auto_renew_flag=0,
    db_version="10.23",
    instance_charge_type="POSTPAID_BY_HOUR",
    memory=4,
    cpu=2,
    storage=250,
    vpc_id=vpc.vpc_id,
    subnet_id=subnet.subnet_id,
    need_support_ipv6=0,
    project_id=0,
    dedicated_cluster_id="cluster-262n63e8",
    security_groups_ids=[example_security_group.security_group_id])
Copy
package main

import (
	"github.com/pulumi/pulumi-terraform-provider/sdks/go/tencentcloud/tencentcloud"
	"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, "")
		availabilityZone := "ap-guangzhou-4"
		if param := cfg.Get("availabilityZone"); param != "" {
			availabilityZone = param
		}
		// create vpc
		vpc, err := tencentcloud.NewVpc(ctx, "vpc", &tencentcloud.VpcArgs{
			CidrBlock: pulumi.String("10.0.0.0/16"),
		})
		if err != nil {
			return err
		}
		// create vpc subnet
		subnet, err := tencentcloud.NewSubnet(ctx, "subnet", &tencentcloud.SubnetArgs{
			AvailabilityZone: pulumi.String(availabilityZone),
			VpcId:            vpc.VpcId,
			CidrBlock:        pulumi.String("10.0.20.0/28"),
			IsMulticast:      pulumi.Bool(false),
		})
		if err != nil {
			return err
		}
		// create postgresql
		examplePostgresqlInstance, err := tencentcloud.NewPostgresqlInstance(ctx, "examplePostgresqlInstance", &tencentcloud.PostgresqlInstanceArgs{
			AvailabilityZone: pulumi.String(availabilityZone),
			ChargeType:       pulumi.String("POSTPAID_BY_HOUR"),
			VpcId:            vpc.VpcId,
			SubnetId:         subnet.SubnetId,
			DbMajorVersion:   pulumi.String("10"),
			RootUser:         pulumi.String("root123"),
			RootPassword:     pulumi.String("Root123$"),
			Charset:          pulumi.String("UTF8"),
			ProjectId:        pulumi.Float64(0),
			Memory:           pulumi.Float64(2),
			Cpu:              pulumi.Float64(1),
			Storage:          pulumi.Float64(10),
			DbNodeSets: tencentcloud.PostgresqlInstanceDbNodeSetArray{
				&tencentcloud.PostgresqlInstanceDbNodeSetArgs{
					Role:               pulumi.String("Primary"),
					Zone:               pulumi.String(availabilityZone),
					DedicatedClusterId: pulumi.String("cluster-262n63e8"),
				},
				&tencentcloud.PostgresqlInstanceDbNodeSetArgs{
					Zone:               pulumi.String(availabilityZone),
					DedicatedClusterId: pulumi.String("cluster-262n63e8"),
				},
			},
			Tags: pulumi.StringMap{
				"CreateBy": pulumi.String("terraform"),
			},
		})
		if err != nil {
			return err
		}
		// create postgresql readonly group
		examplePostgresqlReadonlyGroup, err := tencentcloud.NewPostgresqlReadonlyGroup(ctx, "examplePostgresqlReadonlyGroup", &tencentcloud.PostgresqlReadonlyGroupArgs{
			MasterDbInstanceId:       examplePostgresqlInstance.PostgresqlInstanceId,
			ProjectId:                pulumi.Float64(0),
			VpcId:                    vpc.VpcId,
			SubnetId:                 subnet.SubnetId,
			ReplayLagEliminate:       pulumi.Float64(1),
			ReplayLatencyEliminate:   pulumi.Float64(1),
			MaxReplayLag:             pulumi.Float64(100),
			MaxReplayLatency:         pulumi.Float64(512),
			MinDelayEliminateReserve: pulumi.Float64(1),
		})
		if err != nil {
			return err
		}
		// create security group
		exampleSecurityGroup, err := tencentcloud.NewSecurityGroup(ctx, "exampleSecurityGroup", &tencentcloud.SecurityGroupArgs{
			Description: pulumi.String("sg desc."),
			ProjectId:   pulumi.Float64(0),
			Tags: pulumi.StringMap{
				"CreateBy": pulumi.String("terraform"),
			},
		})
		if err != nil {
			return err
		}
		// create postgresql readonly instance
		_, err = tencentcloud.NewPostgresqlReadonlyInstance(ctx, "examplePostgresqlReadonlyInstance", &tencentcloud.PostgresqlReadonlyInstanceArgs{
			ReadOnlyGroupId:    examplePostgresqlReadonlyGroup.PostgresqlReadonlyGroupId,
			MasterDbInstanceId: examplePostgresqlInstance.PostgresqlInstanceId,
			Zone:               pulumi.String(availabilityZone),
			AutoRenewFlag:      pulumi.Float64(0),
			DbVersion:          pulumi.String("10.23"),
			InstanceChargeType: pulumi.String("POSTPAID_BY_HOUR"),
			Memory:             pulumi.Float64(4),
			Cpu:                pulumi.Float64(2),
			Storage:            pulumi.Float64(250),
			VpcId:              vpc.VpcId,
			SubnetId:           subnet.SubnetId,
			NeedSupportIpv6:    pulumi.Float64(0),
			ProjectId:          pulumi.Float64(0),
			DedicatedClusterId: pulumi.String("cluster-262n63e8"),
			SecurityGroupsIds: pulumi.StringArray{
				exampleSecurityGroup.SecurityGroupId,
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Tencentcloud = Pulumi.Tencentcloud;

return await Deployment.RunAsync(() => 
{
    var config = new Config();
    var availabilityZone = config.Get("availabilityZone") ?? "ap-guangzhou-4";
    // create vpc
    var vpc = new Tencentcloud.Vpc("vpc", new()
    {
        CidrBlock = "10.0.0.0/16",
    });

    // create vpc subnet
    var subnet = new Tencentcloud.Subnet("subnet", new()
    {
        AvailabilityZone = availabilityZone,
        VpcId = vpc.VpcId,
        CidrBlock = "10.0.20.0/28",
        IsMulticast = false,
    });

    // create postgresql
    var examplePostgresqlInstance = new Tencentcloud.PostgresqlInstance("examplePostgresqlInstance", new()
    {
        AvailabilityZone = availabilityZone,
        ChargeType = "POSTPAID_BY_HOUR",
        VpcId = vpc.VpcId,
        SubnetId = subnet.SubnetId,
        DbMajorVersion = "10",
        RootUser = "root123",
        RootPassword = "Root123$",
        Charset = "UTF8",
        ProjectId = 0,
        Memory = 2,
        Cpu = 1,
        Storage = 10,
        DbNodeSets = new[]
        {
            new Tencentcloud.Inputs.PostgresqlInstanceDbNodeSetArgs
            {
                Role = "Primary",
                Zone = availabilityZone,
                DedicatedClusterId = "cluster-262n63e8",
            },
            new Tencentcloud.Inputs.PostgresqlInstanceDbNodeSetArgs
            {
                Zone = availabilityZone,
                DedicatedClusterId = "cluster-262n63e8",
            },
        },
        Tags = 
        {
            { "CreateBy", "terraform" },
        },
    });

    // create postgresql readonly group
    var examplePostgresqlReadonlyGroup = new Tencentcloud.PostgresqlReadonlyGroup("examplePostgresqlReadonlyGroup", new()
    {
        MasterDbInstanceId = examplePostgresqlInstance.PostgresqlInstanceId,
        ProjectId = 0,
        VpcId = vpc.VpcId,
        SubnetId = subnet.SubnetId,
        ReplayLagEliminate = 1,
        ReplayLatencyEliminate = 1,
        MaxReplayLag = 100,
        MaxReplayLatency = 512,
        MinDelayEliminateReserve = 1,
    });

    // create security group
    var exampleSecurityGroup = new Tencentcloud.SecurityGroup("exampleSecurityGroup", new()
    {
        Description = "sg desc.",
        ProjectId = 0,
        Tags = 
        {
            { "CreateBy", "terraform" },
        },
    });

    // create postgresql readonly instance
    var examplePostgresqlReadonlyInstance = new Tencentcloud.PostgresqlReadonlyInstance("examplePostgresqlReadonlyInstance", new()
    {
        ReadOnlyGroupId = examplePostgresqlReadonlyGroup.PostgresqlReadonlyGroupId,
        MasterDbInstanceId = examplePostgresqlInstance.PostgresqlInstanceId,
        Zone = availabilityZone,
        AutoRenewFlag = 0,
        DbVersion = "10.23",
        InstanceChargeType = "POSTPAID_BY_HOUR",
        Memory = 4,
        Cpu = 2,
        Storage = 250,
        VpcId = vpc.VpcId,
        SubnetId = subnet.SubnetId,
        NeedSupportIpv6 = 0,
        ProjectId = 0,
        DedicatedClusterId = "cluster-262n63e8",
        SecurityGroupsIds = new[]
        {
            exampleSecurityGroup.SecurityGroupId,
        },
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.tencentcloud.Vpc;
import com.pulumi.tencentcloud.VpcArgs;
import com.pulumi.tencentcloud.Subnet;
import com.pulumi.tencentcloud.SubnetArgs;
import com.pulumi.tencentcloud.PostgresqlInstance;
import com.pulumi.tencentcloud.PostgresqlInstanceArgs;
import com.pulumi.tencentcloud.inputs.PostgresqlInstanceDbNodeSetArgs;
import com.pulumi.tencentcloud.PostgresqlReadonlyGroup;
import com.pulumi.tencentcloud.PostgresqlReadonlyGroupArgs;
import com.pulumi.tencentcloud.SecurityGroup;
import com.pulumi.tencentcloud.SecurityGroupArgs;
import com.pulumi.tencentcloud.PostgresqlReadonlyInstance;
import com.pulumi.tencentcloud.PostgresqlReadonlyInstanceArgs;
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 availabilityZone = config.get("availabilityZone").orElse("ap-guangzhou-4");
        // create vpc
        var vpc = new Vpc("vpc", VpcArgs.builder()
            .cidrBlock("10.0.0.0/16")
            .build());

        // create vpc subnet
        var subnet = new Subnet("subnet", SubnetArgs.builder()
            .availabilityZone(availabilityZone)
            .vpcId(vpc.vpcId())
            .cidrBlock("10.0.20.0/28")
            .isMulticast(false)
            .build());

        // create postgresql
        var examplePostgresqlInstance = new PostgresqlInstance("examplePostgresqlInstance", PostgresqlInstanceArgs.builder()
            .availabilityZone(availabilityZone)
            .chargeType("POSTPAID_BY_HOUR")
            .vpcId(vpc.vpcId())
            .subnetId(subnet.subnetId())
            .dbMajorVersion("10")
            .rootUser("root123")
            .rootPassword("Root123$")
            .charset("UTF8")
            .projectId(0)
            .memory(2)
            .cpu(1)
            .storage(10)
            .dbNodeSets(            
                PostgresqlInstanceDbNodeSetArgs.builder()
                    .role("Primary")
                    .zone(availabilityZone)
                    .dedicatedClusterId("cluster-262n63e8")
                    .build(),
                PostgresqlInstanceDbNodeSetArgs.builder()
                    .zone(availabilityZone)
                    .dedicatedClusterId("cluster-262n63e8")
                    .build())
            .tags(Map.of("CreateBy", "terraform"))
            .build());

        // create postgresql readonly group
        var examplePostgresqlReadonlyGroup = new PostgresqlReadonlyGroup("examplePostgresqlReadonlyGroup", PostgresqlReadonlyGroupArgs.builder()
            .masterDbInstanceId(examplePostgresqlInstance.postgresqlInstanceId())
            .projectId(0)
            .vpcId(vpc.vpcId())
            .subnetId(subnet.subnetId())
            .replayLagEliminate(1)
            .replayLatencyEliminate(1)
            .maxReplayLag(100)
            .maxReplayLatency(512)
            .minDelayEliminateReserve(1)
            .build());

        // create security group
        var exampleSecurityGroup = new SecurityGroup("exampleSecurityGroup", SecurityGroupArgs.builder()
            .description("sg desc.")
            .projectId(0)
            .tags(Map.of("CreateBy", "terraform"))
            .build());

        // create postgresql readonly instance
        var examplePostgresqlReadonlyInstance = new PostgresqlReadonlyInstance("examplePostgresqlReadonlyInstance", PostgresqlReadonlyInstanceArgs.builder()
            .readOnlyGroupId(examplePostgresqlReadonlyGroup.postgresqlReadonlyGroupId())
            .masterDbInstanceId(examplePostgresqlInstance.postgresqlInstanceId())
            .zone(availabilityZone)
            .autoRenewFlag(0)
            .dbVersion("10.23")
            .instanceChargeType("POSTPAID_BY_HOUR")
            .memory(4)
            .cpu(2)
            .storage(250)
            .vpcId(vpc.vpcId())
            .subnetId(subnet.subnetId())
            .needSupportIpv6(0)
            .projectId(0)
            .dedicatedClusterId("cluster-262n63e8")
            .securityGroupsIds(exampleSecurityGroup.securityGroupId())
            .build());

    }
}
Copy
configuration:
  availabilityZone:
    type: string
    default: ap-guangzhou-4
resources:
  # create vpc
  vpc:
    type: tencentcloud:Vpc
    properties:
      cidrBlock: 10.0.0.0/16
  # create vpc subnet
  subnet:
    type: tencentcloud:Subnet
    properties:
      availabilityZone: ${availabilityZone}
      vpcId: ${vpc.vpcId}
      cidrBlock: 10.0.20.0/28
      isMulticast: false
  # create postgresql
  examplePostgresqlInstance:
    type: tencentcloud:PostgresqlInstance
    properties:
      availabilityZone: ${availabilityZone}
      chargeType: POSTPAID_BY_HOUR
      vpcId: ${vpc.vpcId}
      subnetId: ${subnet.subnetId}
      dbMajorVersion: '10'
      rootUser: root123
      rootPassword: Root123$
      charset: UTF8
      projectId: 0
      memory: 2
      cpu: 1
      storage: 10
      dbNodeSets:
        - role: Primary
          zone: ${availabilityZone}
          dedicatedClusterId: cluster-262n63e8
        - zone: ${availabilityZone}
          dedicatedClusterId: cluster-262n63e8
      tags:
        CreateBy: terraform
  # create postgresql readonly group
  examplePostgresqlReadonlyGroup:
    type: tencentcloud:PostgresqlReadonlyGroup
    properties:
      masterDbInstanceId: ${examplePostgresqlInstance.postgresqlInstanceId}
      projectId: 0
      vpcId: ${vpc.vpcId}
      subnetId: ${subnet.subnetId}
      replayLagEliminate: 1
      replayLatencyEliminate: 1
      maxReplayLag: 100
      maxReplayLatency: 512
      minDelayEliminateReserve: 1
  # create security group
  exampleSecurityGroup:
    type: tencentcloud:SecurityGroup
    properties:
      description: sg desc.
      projectId: 0
      tags:
        CreateBy: terraform
  # create postgresql readonly instance
  examplePostgresqlReadonlyInstance:
    type: tencentcloud:PostgresqlReadonlyInstance
    properties:
      readOnlyGroupId: ${examplePostgresqlReadonlyGroup.postgresqlReadonlyGroupId}
      masterDbInstanceId: ${examplePostgresqlInstance.postgresqlInstanceId}
      zone: ${availabilityZone}
      autoRenewFlag: 0
      dbVersion: '10.23'
      instanceChargeType: POSTPAID_BY_HOUR
      memory: 4
      cpu: 2
      storage: 250
      vpcId: ${vpc.vpcId}
      subnetId: ${subnet.subnetId}
      needSupportIpv6: 0
      projectId: 0
      dedicatedClusterId: cluster-262n63e8
      securityGroupsIds:
        - ${exampleSecurityGroup.securityGroupId}
Copy

Create PostgresqlReadonlyInstance Resource

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

Constructor syntax

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

@overload
def PostgresqlReadonlyInstance(resource_name: str,
                               opts: Optional[ResourceOptions] = None,
                               project_id: Optional[float] = None,
                               zone: Optional[str] = None,
                               vpc_id: Optional[str] = None,
                               db_version: Optional[str] = None,
                               subnet_id: Optional[str] = None,
                               storage: Optional[float] = None,
                               master_db_instance_id: Optional[str] = None,
                               memory: Optional[float] = None,
                               security_groups_ids: Optional[Sequence[str]] = None,
                               instance_charge_type: Optional[str] = None,
                               period: Optional[float] = None,
                               postgresql_readonly_instance_id: Optional[str] = None,
                               need_support_ipv6: Optional[float] = None,
                               read_only_group_id: Optional[str] = None,
                               name: Optional[str] = None,
                               auto_renew_flag: Optional[float] = None,
                               dedicated_cluster_id: Optional[str] = None,
                               voucher_ids: Optional[Sequence[str]] = None,
                               cpu: Optional[float] = None,
                               wait_switch: Optional[float] = None,
                               auto_voucher: Optional[float] = None)
func NewPostgresqlReadonlyInstance(ctx *Context, name string, args PostgresqlReadonlyInstanceArgs, opts ...ResourceOption) (*PostgresqlReadonlyInstance, error)
public PostgresqlReadonlyInstance(string name, PostgresqlReadonlyInstanceArgs args, CustomResourceOptions? opts = null)
public PostgresqlReadonlyInstance(String name, PostgresqlReadonlyInstanceArgs args)
public PostgresqlReadonlyInstance(String name, PostgresqlReadonlyInstanceArgs args, CustomResourceOptions options)
type: tencentcloud:PostgresqlReadonlyInstance
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. PostgresqlReadonlyInstanceArgs
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. PostgresqlReadonlyInstanceArgs
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. PostgresqlReadonlyInstanceArgs
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. PostgresqlReadonlyInstanceArgs
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. PostgresqlReadonlyInstanceArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

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

DbVersion This property is required. string
PostgreSQL kernel version, which must be the same as that of the primary instance.
MasterDbInstanceId This property is required. string
ID of the primary instance to which the read-only replica belongs.
Memory This property is required. double
Memory size(in GB). Allowed value must be larger than memory that data source tencentcloud.getPostgresqlSpecinfos provides.
ProjectId This property is required. double
Project ID.
SecurityGroupsIds This property is required. List<string>
ID of security group.
Storage This property is required. double
Instance storage capacity in GB.
SubnetId This property is required. string
VPC subnet ID.
VpcId This property is required. string
VPC ID.
Zone This property is required. string
Availability zone ID, which can be obtained through the Zone field in the returned value of the DescribeZones API.
AutoRenewFlag double
Auto renew flag, 1 for enabled. NOTES: Only support prepaid instance.
AutoVoucher double
Whether to use voucher, 1 for enabled.
Cpu double
Number of CPU cores. Allowed value must be equal cpu that data source tencentcloud.getPostgresqlSpecinfos provides.
DedicatedClusterId string
Dedicated cluster ID.
InstanceChargeType string
instance billing mode. Valid values: PREPAID (monthly subscription), POSTPAID_BY_HOUR (pay-as-you-go).
Name string
Instance name.
NeedSupportIpv6 double
Whether to support IPv6 address access. Valid values: 1 (yes), 0 (no).
Period double
Specify Prepaid period in month. Default 1. Values: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 24, 36.
PostgresqlReadonlyInstanceId string
ID of the resource.
ReadOnlyGroupId string
RO group ID.
VoucherIds List<string>
Specify Voucher Ids if auto_voucher was 1, only support using 1 vouchers for now.
WaitSwitch double
Switch time after instance configurations are modified. 0: Switch immediately; 2: Switch during maintenance time window. Default: 0. Note: This only takes effect when updating the memory, storage, cpu fields.
DbVersion This property is required. string
PostgreSQL kernel version, which must be the same as that of the primary instance.
MasterDbInstanceId This property is required. string
ID of the primary instance to which the read-only replica belongs.
Memory This property is required. float64
Memory size(in GB). Allowed value must be larger than memory that data source tencentcloud.getPostgresqlSpecinfos provides.
ProjectId This property is required. float64
Project ID.
SecurityGroupsIds This property is required. []string
ID of security group.
Storage This property is required. float64
Instance storage capacity in GB.
SubnetId This property is required. string
VPC subnet ID.
VpcId This property is required. string
VPC ID.
Zone This property is required. string
Availability zone ID, which can be obtained through the Zone field in the returned value of the DescribeZones API.
AutoRenewFlag float64
Auto renew flag, 1 for enabled. NOTES: Only support prepaid instance.
AutoVoucher float64
Whether to use voucher, 1 for enabled.
Cpu float64
Number of CPU cores. Allowed value must be equal cpu that data source tencentcloud.getPostgresqlSpecinfos provides.
DedicatedClusterId string
Dedicated cluster ID.
InstanceChargeType string
instance billing mode. Valid values: PREPAID (monthly subscription), POSTPAID_BY_HOUR (pay-as-you-go).
Name string
Instance name.
NeedSupportIpv6 float64
Whether to support IPv6 address access. Valid values: 1 (yes), 0 (no).
Period float64
Specify Prepaid period in month. Default 1. Values: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 24, 36.
PostgresqlReadonlyInstanceId string
ID of the resource.
ReadOnlyGroupId string
RO group ID.
VoucherIds []string
Specify Voucher Ids if auto_voucher was 1, only support using 1 vouchers for now.
WaitSwitch float64
Switch time after instance configurations are modified. 0: Switch immediately; 2: Switch during maintenance time window. Default: 0. Note: This only takes effect when updating the memory, storage, cpu fields.
dbVersion This property is required. String
PostgreSQL kernel version, which must be the same as that of the primary instance.
masterDbInstanceId This property is required. String
ID of the primary instance to which the read-only replica belongs.
memory This property is required. Double
Memory size(in GB). Allowed value must be larger than memory that data source tencentcloud.getPostgresqlSpecinfos provides.
projectId This property is required. Double
Project ID.
securityGroupsIds This property is required. List<String>
ID of security group.
storage This property is required. Double
Instance storage capacity in GB.
subnetId This property is required. String
VPC subnet ID.
vpcId This property is required. String
VPC ID.
zone This property is required. String
Availability zone ID, which can be obtained through the Zone field in the returned value of the DescribeZones API.
autoRenewFlag Double
Auto renew flag, 1 for enabled. NOTES: Only support prepaid instance.
autoVoucher Double
Whether to use voucher, 1 for enabled.
cpu Double
Number of CPU cores. Allowed value must be equal cpu that data source tencentcloud.getPostgresqlSpecinfos provides.
dedicatedClusterId String
Dedicated cluster ID.
instanceChargeType String
instance billing mode. Valid values: PREPAID (monthly subscription), POSTPAID_BY_HOUR (pay-as-you-go).
name String
Instance name.
needSupportIpv6 Double
Whether to support IPv6 address access. Valid values: 1 (yes), 0 (no).
period Double
Specify Prepaid period in month. Default 1. Values: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 24, 36.
postgresqlReadonlyInstanceId String
ID of the resource.
readOnlyGroupId String
RO group ID.
voucherIds List<String>
Specify Voucher Ids if auto_voucher was 1, only support using 1 vouchers for now.
waitSwitch Double
Switch time after instance configurations are modified. 0: Switch immediately; 2: Switch during maintenance time window. Default: 0. Note: This only takes effect when updating the memory, storage, cpu fields.
dbVersion This property is required. string
PostgreSQL kernel version, which must be the same as that of the primary instance.
masterDbInstanceId This property is required. string
ID of the primary instance to which the read-only replica belongs.
memory This property is required. number
Memory size(in GB). Allowed value must be larger than memory that data source tencentcloud.getPostgresqlSpecinfos provides.
projectId This property is required. number
Project ID.
securityGroupsIds This property is required. string[]
ID of security group.
storage This property is required. number
Instance storage capacity in GB.
subnetId This property is required. string
VPC subnet ID.
vpcId This property is required. string
VPC ID.
zone This property is required. string
Availability zone ID, which can be obtained through the Zone field in the returned value of the DescribeZones API.
autoRenewFlag number
Auto renew flag, 1 for enabled. NOTES: Only support prepaid instance.
autoVoucher number
Whether to use voucher, 1 for enabled.
cpu number
Number of CPU cores. Allowed value must be equal cpu that data source tencentcloud.getPostgresqlSpecinfos provides.
dedicatedClusterId string
Dedicated cluster ID.
instanceChargeType string
instance billing mode. Valid values: PREPAID (monthly subscription), POSTPAID_BY_HOUR (pay-as-you-go).
name string
Instance name.
needSupportIpv6 number
Whether to support IPv6 address access. Valid values: 1 (yes), 0 (no).
period number
Specify Prepaid period in month. Default 1. Values: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 24, 36.
postgresqlReadonlyInstanceId string
ID of the resource.
readOnlyGroupId string
RO group ID.
voucherIds string[]
Specify Voucher Ids if auto_voucher was 1, only support using 1 vouchers for now.
waitSwitch number
Switch time after instance configurations are modified. 0: Switch immediately; 2: Switch during maintenance time window. Default: 0. Note: This only takes effect when updating the memory, storage, cpu fields.
db_version This property is required. str
PostgreSQL kernel version, which must be the same as that of the primary instance.
master_db_instance_id This property is required. str
ID of the primary instance to which the read-only replica belongs.
memory This property is required. float
Memory size(in GB). Allowed value must be larger than memory that data source tencentcloud.getPostgresqlSpecinfos provides.
project_id This property is required. float
Project ID.
security_groups_ids This property is required. Sequence[str]
ID of security group.
storage This property is required. float
Instance storage capacity in GB.
subnet_id This property is required. str
VPC subnet ID.
vpc_id This property is required. str
VPC ID.
zone This property is required. str
Availability zone ID, which can be obtained through the Zone field in the returned value of the DescribeZones API.
auto_renew_flag float
Auto renew flag, 1 for enabled. NOTES: Only support prepaid instance.
auto_voucher float
Whether to use voucher, 1 for enabled.
cpu float
Number of CPU cores. Allowed value must be equal cpu that data source tencentcloud.getPostgresqlSpecinfos provides.
dedicated_cluster_id str
Dedicated cluster ID.
instance_charge_type str
instance billing mode. Valid values: PREPAID (monthly subscription), POSTPAID_BY_HOUR (pay-as-you-go).
name str
Instance name.
need_support_ipv6 float
Whether to support IPv6 address access. Valid values: 1 (yes), 0 (no).
period float
Specify Prepaid period in month. Default 1. Values: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 24, 36.
postgresql_readonly_instance_id str
ID of the resource.
read_only_group_id str
RO group ID.
voucher_ids Sequence[str]
Specify Voucher Ids if auto_voucher was 1, only support using 1 vouchers for now.
wait_switch float
Switch time after instance configurations are modified. 0: Switch immediately; 2: Switch during maintenance time window. Default: 0. Note: This only takes effect when updating the memory, storage, cpu fields.
dbVersion This property is required. String
PostgreSQL kernel version, which must be the same as that of the primary instance.
masterDbInstanceId This property is required. String
ID of the primary instance to which the read-only replica belongs.
memory This property is required. Number
Memory size(in GB). Allowed value must be larger than memory that data source tencentcloud.getPostgresqlSpecinfos provides.
projectId This property is required. Number
Project ID.
securityGroupsIds This property is required. List<String>
ID of security group.
storage This property is required. Number
Instance storage capacity in GB.
subnetId This property is required. String
VPC subnet ID.
vpcId This property is required. String
VPC ID.
zone This property is required. String
Availability zone ID, which can be obtained through the Zone field in the returned value of the DescribeZones API.
autoRenewFlag Number
Auto renew flag, 1 for enabled. NOTES: Only support prepaid instance.
autoVoucher Number
Whether to use voucher, 1 for enabled.
cpu Number
Number of CPU cores. Allowed value must be equal cpu that data source tencentcloud.getPostgresqlSpecinfos provides.
dedicatedClusterId String
Dedicated cluster ID.
instanceChargeType String
instance billing mode. Valid values: PREPAID (monthly subscription), POSTPAID_BY_HOUR (pay-as-you-go).
name String
Instance name.
needSupportIpv6 Number
Whether to support IPv6 address access. Valid values: 1 (yes), 0 (no).
period Number
Specify Prepaid period in month. Default 1. Values: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 24, 36.
postgresqlReadonlyInstanceId String
ID of the resource.
readOnlyGroupId String
RO group ID.
voucherIds List<String>
Specify Voucher Ids if auto_voucher was 1, only support using 1 vouchers for now.
waitSwitch Number
Switch time after instance configurations are modified. 0: Switch immediately; 2: Switch during maintenance time window. Default: 0. Note: This only takes effect when updating the memory, storage, cpu fields.

Outputs

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

CreateTime string
Create time of the postgresql instance.
Id string
The provider-assigned unique ID for this managed resource.
InstanceId string
The instance ID of this readonly resource.
PrivateAccessIp string
IP for private access.
PrivateAccessPort double
Port for private access.
CreateTime string
Create time of the postgresql instance.
Id string
The provider-assigned unique ID for this managed resource.
InstanceId string
The instance ID of this readonly resource.
PrivateAccessIp string
IP for private access.
PrivateAccessPort float64
Port for private access.
createTime String
Create time of the postgresql instance.
id String
The provider-assigned unique ID for this managed resource.
instanceId String
The instance ID of this readonly resource.
privateAccessIp String
IP for private access.
privateAccessPort Double
Port for private access.
createTime string
Create time of the postgresql instance.
id string
The provider-assigned unique ID for this managed resource.
instanceId string
The instance ID of this readonly resource.
privateAccessIp string
IP for private access.
privateAccessPort number
Port for private access.
create_time str
Create time of the postgresql instance.
id str
The provider-assigned unique ID for this managed resource.
instance_id str
The instance ID of this readonly resource.
private_access_ip str
IP for private access.
private_access_port float
Port for private access.
createTime String
Create time of the postgresql instance.
id String
The provider-assigned unique ID for this managed resource.
instanceId String
The instance ID of this readonly resource.
privateAccessIp String
IP for private access.
privateAccessPort Number
Port for private access.

Look up Existing PostgresqlReadonlyInstance Resource

Get an existing PostgresqlReadonlyInstance 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?: PostgresqlReadonlyInstanceState, opts?: CustomResourceOptions): PostgresqlReadonlyInstance
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        auto_renew_flag: Optional[float] = None,
        auto_voucher: Optional[float] = None,
        cpu: Optional[float] = None,
        create_time: Optional[str] = None,
        db_version: Optional[str] = None,
        dedicated_cluster_id: Optional[str] = None,
        instance_charge_type: Optional[str] = None,
        instance_id: Optional[str] = None,
        master_db_instance_id: Optional[str] = None,
        memory: Optional[float] = None,
        name: Optional[str] = None,
        need_support_ipv6: Optional[float] = None,
        period: Optional[float] = None,
        postgresql_readonly_instance_id: Optional[str] = None,
        private_access_ip: Optional[str] = None,
        private_access_port: Optional[float] = None,
        project_id: Optional[float] = None,
        read_only_group_id: Optional[str] = None,
        security_groups_ids: Optional[Sequence[str]] = None,
        storage: Optional[float] = None,
        subnet_id: Optional[str] = None,
        voucher_ids: Optional[Sequence[str]] = None,
        vpc_id: Optional[str] = None,
        wait_switch: Optional[float] = None,
        zone: Optional[str] = None) -> PostgresqlReadonlyInstance
func GetPostgresqlReadonlyInstance(ctx *Context, name string, id IDInput, state *PostgresqlReadonlyInstanceState, opts ...ResourceOption) (*PostgresqlReadonlyInstance, error)
public static PostgresqlReadonlyInstance Get(string name, Input<string> id, PostgresqlReadonlyInstanceState? state, CustomResourceOptions? opts = null)
public static PostgresqlReadonlyInstance get(String name, Output<String> id, PostgresqlReadonlyInstanceState state, CustomResourceOptions options)
resources:  _:    type: tencentcloud:PostgresqlReadonlyInstance    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:
AutoRenewFlag double
Auto renew flag, 1 for enabled. NOTES: Only support prepaid instance.
AutoVoucher double
Whether to use voucher, 1 for enabled.
Cpu double
Number of CPU cores. Allowed value must be equal cpu that data source tencentcloud.getPostgresqlSpecinfos provides.
CreateTime string
Create time of the postgresql instance.
DbVersion string
PostgreSQL kernel version, which must be the same as that of the primary instance.
DedicatedClusterId string
Dedicated cluster ID.
InstanceChargeType string
instance billing mode. Valid values: PREPAID (monthly subscription), POSTPAID_BY_HOUR (pay-as-you-go).
InstanceId string
The instance ID of this readonly resource.
MasterDbInstanceId string
ID of the primary instance to which the read-only replica belongs.
Memory double
Memory size(in GB). Allowed value must be larger than memory that data source tencentcloud.getPostgresqlSpecinfos provides.
Name string
Instance name.
NeedSupportIpv6 double
Whether to support IPv6 address access. Valid values: 1 (yes), 0 (no).
Period double
Specify Prepaid period in month. Default 1. Values: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 24, 36.
PostgresqlReadonlyInstanceId string
ID of the resource.
PrivateAccessIp string
IP for private access.
PrivateAccessPort double
Port for private access.
ProjectId double
Project ID.
ReadOnlyGroupId string
RO group ID.
SecurityGroupsIds List<string>
ID of security group.
Storage double
Instance storage capacity in GB.
SubnetId string
VPC subnet ID.
VoucherIds List<string>
Specify Voucher Ids if auto_voucher was 1, only support using 1 vouchers for now.
VpcId string
VPC ID.
WaitSwitch double
Switch time after instance configurations are modified. 0: Switch immediately; 2: Switch during maintenance time window. Default: 0. Note: This only takes effect when updating the memory, storage, cpu fields.
Zone string
Availability zone ID, which can be obtained through the Zone field in the returned value of the DescribeZones API.
AutoRenewFlag float64
Auto renew flag, 1 for enabled. NOTES: Only support prepaid instance.
AutoVoucher float64
Whether to use voucher, 1 for enabled.
Cpu float64
Number of CPU cores. Allowed value must be equal cpu that data source tencentcloud.getPostgresqlSpecinfos provides.
CreateTime string
Create time of the postgresql instance.
DbVersion string
PostgreSQL kernel version, which must be the same as that of the primary instance.
DedicatedClusterId string
Dedicated cluster ID.
InstanceChargeType string
instance billing mode. Valid values: PREPAID (monthly subscription), POSTPAID_BY_HOUR (pay-as-you-go).
InstanceId string
The instance ID of this readonly resource.
MasterDbInstanceId string
ID of the primary instance to which the read-only replica belongs.
Memory float64
Memory size(in GB). Allowed value must be larger than memory that data source tencentcloud.getPostgresqlSpecinfos provides.
Name string
Instance name.
NeedSupportIpv6 float64
Whether to support IPv6 address access. Valid values: 1 (yes), 0 (no).
Period float64
Specify Prepaid period in month. Default 1. Values: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 24, 36.
PostgresqlReadonlyInstanceId string
ID of the resource.
PrivateAccessIp string
IP for private access.
PrivateAccessPort float64
Port for private access.
ProjectId float64
Project ID.
ReadOnlyGroupId string
RO group ID.
SecurityGroupsIds []string
ID of security group.
Storage float64
Instance storage capacity in GB.
SubnetId string
VPC subnet ID.
VoucherIds []string
Specify Voucher Ids if auto_voucher was 1, only support using 1 vouchers for now.
VpcId string
VPC ID.
WaitSwitch float64
Switch time after instance configurations are modified. 0: Switch immediately; 2: Switch during maintenance time window. Default: 0. Note: This only takes effect when updating the memory, storage, cpu fields.
Zone string
Availability zone ID, which can be obtained through the Zone field in the returned value of the DescribeZones API.
autoRenewFlag Double
Auto renew flag, 1 for enabled. NOTES: Only support prepaid instance.
autoVoucher Double
Whether to use voucher, 1 for enabled.
cpu Double
Number of CPU cores. Allowed value must be equal cpu that data source tencentcloud.getPostgresqlSpecinfos provides.
createTime String
Create time of the postgresql instance.
dbVersion String
PostgreSQL kernel version, which must be the same as that of the primary instance.
dedicatedClusterId String
Dedicated cluster ID.
instanceChargeType String
instance billing mode. Valid values: PREPAID (monthly subscription), POSTPAID_BY_HOUR (pay-as-you-go).
instanceId String
The instance ID of this readonly resource.
masterDbInstanceId String
ID of the primary instance to which the read-only replica belongs.
memory Double
Memory size(in GB). Allowed value must be larger than memory that data source tencentcloud.getPostgresqlSpecinfos provides.
name String
Instance name.
needSupportIpv6 Double
Whether to support IPv6 address access. Valid values: 1 (yes), 0 (no).
period Double
Specify Prepaid period in month. Default 1. Values: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 24, 36.
postgresqlReadonlyInstanceId String
ID of the resource.
privateAccessIp String
IP for private access.
privateAccessPort Double
Port for private access.
projectId Double
Project ID.
readOnlyGroupId String
RO group ID.
securityGroupsIds List<String>
ID of security group.
storage Double
Instance storage capacity in GB.
subnetId String
VPC subnet ID.
voucherIds List<String>
Specify Voucher Ids if auto_voucher was 1, only support using 1 vouchers for now.
vpcId String
VPC ID.
waitSwitch Double
Switch time after instance configurations are modified. 0: Switch immediately; 2: Switch during maintenance time window. Default: 0. Note: This only takes effect when updating the memory, storage, cpu fields.
zone String
Availability zone ID, which can be obtained through the Zone field in the returned value of the DescribeZones API.
autoRenewFlag number
Auto renew flag, 1 for enabled. NOTES: Only support prepaid instance.
autoVoucher number
Whether to use voucher, 1 for enabled.
cpu number
Number of CPU cores. Allowed value must be equal cpu that data source tencentcloud.getPostgresqlSpecinfos provides.
createTime string
Create time of the postgresql instance.
dbVersion string
PostgreSQL kernel version, which must be the same as that of the primary instance.
dedicatedClusterId string
Dedicated cluster ID.
instanceChargeType string
instance billing mode. Valid values: PREPAID (monthly subscription), POSTPAID_BY_HOUR (pay-as-you-go).
instanceId string
The instance ID of this readonly resource.
masterDbInstanceId string
ID of the primary instance to which the read-only replica belongs.
memory number
Memory size(in GB). Allowed value must be larger than memory that data source tencentcloud.getPostgresqlSpecinfos provides.
name string
Instance name.
needSupportIpv6 number
Whether to support IPv6 address access. Valid values: 1 (yes), 0 (no).
period number
Specify Prepaid period in month. Default 1. Values: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 24, 36.
postgresqlReadonlyInstanceId string
ID of the resource.
privateAccessIp string
IP for private access.
privateAccessPort number
Port for private access.
projectId number
Project ID.
readOnlyGroupId string
RO group ID.
securityGroupsIds string[]
ID of security group.
storage number
Instance storage capacity in GB.
subnetId string
VPC subnet ID.
voucherIds string[]
Specify Voucher Ids if auto_voucher was 1, only support using 1 vouchers for now.
vpcId string
VPC ID.
waitSwitch number
Switch time after instance configurations are modified. 0: Switch immediately; 2: Switch during maintenance time window. Default: 0. Note: This only takes effect when updating the memory, storage, cpu fields.
zone string
Availability zone ID, which can be obtained through the Zone field in the returned value of the DescribeZones API.
auto_renew_flag float
Auto renew flag, 1 for enabled. NOTES: Only support prepaid instance.
auto_voucher float
Whether to use voucher, 1 for enabled.
cpu float
Number of CPU cores. Allowed value must be equal cpu that data source tencentcloud.getPostgresqlSpecinfos provides.
create_time str
Create time of the postgresql instance.
db_version str
PostgreSQL kernel version, which must be the same as that of the primary instance.
dedicated_cluster_id str
Dedicated cluster ID.
instance_charge_type str
instance billing mode. Valid values: PREPAID (monthly subscription), POSTPAID_BY_HOUR (pay-as-you-go).
instance_id str
The instance ID of this readonly resource.
master_db_instance_id str
ID of the primary instance to which the read-only replica belongs.
memory float
Memory size(in GB). Allowed value must be larger than memory that data source tencentcloud.getPostgresqlSpecinfos provides.
name str
Instance name.
need_support_ipv6 float
Whether to support IPv6 address access. Valid values: 1 (yes), 0 (no).
period float
Specify Prepaid period in month. Default 1. Values: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 24, 36.
postgresql_readonly_instance_id str
ID of the resource.
private_access_ip str
IP for private access.
private_access_port float
Port for private access.
project_id float
Project ID.
read_only_group_id str
RO group ID.
security_groups_ids Sequence[str]
ID of security group.
storage float
Instance storage capacity in GB.
subnet_id str
VPC subnet ID.
voucher_ids Sequence[str]
Specify Voucher Ids if auto_voucher was 1, only support using 1 vouchers for now.
vpc_id str
VPC ID.
wait_switch float
Switch time after instance configurations are modified. 0: Switch immediately; 2: Switch during maintenance time window. Default: 0. Note: This only takes effect when updating the memory, storage, cpu fields.
zone str
Availability zone ID, which can be obtained through the Zone field in the returned value of the DescribeZones API.
autoRenewFlag Number
Auto renew flag, 1 for enabled. NOTES: Only support prepaid instance.
autoVoucher Number
Whether to use voucher, 1 for enabled.
cpu Number
Number of CPU cores. Allowed value must be equal cpu that data source tencentcloud.getPostgresqlSpecinfos provides.
createTime String
Create time of the postgresql instance.
dbVersion String
PostgreSQL kernel version, which must be the same as that of the primary instance.
dedicatedClusterId String
Dedicated cluster ID.
instanceChargeType String
instance billing mode. Valid values: PREPAID (monthly subscription), POSTPAID_BY_HOUR (pay-as-you-go).
instanceId String
The instance ID of this readonly resource.
masterDbInstanceId String
ID of the primary instance to which the read-only replica belongs.
memory Number
Memory size(in GB). Allowed value must be larger than memory that data source tencentcloud.getPostgresqlSpecinfos provides.
name String
Instance name.
needSupportIpv6 Number
Whether to support IPv6 address access. Valid values: 1 (yes), 0 (no).
period Number
Specify Prepaid period in month. Default 1. Values: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 24, 36.
postgresqlReadonlyInstanceId String
ID of the resource.
privateAccessIp String
IP for private access.
privateAccessPort Number
Port for private access.
projectId Number
Project ID.
readOnlyGroupId String
RO group ID.
securityGroupsIds List<String>
ID of security group.
storage Number
Instance storage capacity in GB.
subnetId String
VPC subnet ID.
voucherIds List<String>
Specify Voucher Ids if auto_voucher was 1, only support using 1 vouchers for now.
vpcId String
VPC ID.
waitSwitch Number
Switch time after instance configurations are modified. 0: Switch immediately; 2: Switch during maintenance time window. Default: 0. Note: This only takes effect when updating the memory, storage, cpu fields.
zone String
Availability zone ID, which can be obtained through the Zone field in the returned value of the DescribeZones API.

Import

postgresql readonly instance can be imported using the id, e.g.

$ pulumi import tencentcloud:index/postgresqlReadonlyInstance:PostgresqlReadonlyInstance example pgro-gih5m0ke
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
tencentcloud tencentcloudstack/terraform-provider-tencentcloud
License
Notes
This Pulumi package is based on the tencentcloud Terraform Provider.