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],
});
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])
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
})
}
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,
},
});
});
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());
}
}
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}
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],
});
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])
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
})
}
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,
},
});
});
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());
}
}
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}
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 string
- The unique name of the resource.
- args PostgresqlReadonlyInstanceArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args 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 string
- The unique name of the resource.
- args PostgresqlReadonlyInstanceArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args PostgresqlReadonlyInstanceArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args 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:
- Db
Version string - PostgreSQL kernel version, which must be the same as that of the primary instance.
- Master
Db stringInstance Id - 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 sourcetencentcloud.getPostgresqlSpecinfos
provides. - Project
Id double - Project ID.
- Security
Groups List<string>Ids - ID of security group.
- Storage double
- Instance storage capacity in GB.
- Subnet
Id string - VPC subnet ID.
- Vpc
Id string - VPC ID.
- Zone string
- Availability zone ID, which can be obtained through the Zone field in the returned value of the DescribeZones API.
- Auto
Renew doubleFlag - Auto renew flag,
1
for enabled. NOTES: Only support prepaid instance. - Auto
Voucher double - Whether to use voucher,
1
for enabled. - Cpu double
- Number of CPU cores. Allowed value must be equal
cpu
that data sourcetencentcloud.getPostgresqlSpecinfos
provides. - Dedicated
Cluster stringId - Dedicated cluster ID.
- Instance
Charge stringType - instance billing mode. Valid values: PREPAID (monthly subscription), POSTPAID_BY_HOUR (pay-as-you-go).
- Name string
- Instance name.
- Need
Support doubleIpv6 - 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
. - Postgresql
Readonly stringInstance Id - ID of the resource.
- Read
Only stringGroup Id - RO group ID.
- Voucher
Ids List<string> - Specify Voucher Ids if
auto_voucher
was1
, only support using 1 vouchers for now. - Wait
Switch 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 thememory
,storage
,cpu
fields.
- Db
Version string - PostgreSQL kernel version, which must be the same as that of the primary instance.
- Master
Db stringInstance Id - 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 sourcetencentcloud.getPostgresqlSpecinfos
provides. - Project
Id float64 - Project ID.
- Security
Groups []stringIds - ID of security group.
- Storage float64
- Instance storage capacity in GB.
- Subnet
Id string - VPC subnet ID.
- Vpc
Id string - VPC ID.
- Zone string
- Availability zone ID, which can be obtained through the Zone field in the returned value of the DescribeZones API.
- Auto
Renew float64Flag - Auto renew flag,
1
for enabled. NOTES: Only support prepaid instance. - Auto
Voucher float64 - Whether to use voucher,
1
for enabled. - Cpu float64
- Number of CPU cores. Allowed value must be equal
cpu
that data sourcetencentcloud.getPostgresqlSpecinfos
provides. - Dedicated
Cluster stringId - Dedicated cluster ID.
- Instance
Charge stringType - instance billing mode. Valid values: PREPAID (monthly subscription), POSTPAID_BY_HOUR (pay-as-you-go).
- Name string
- Instance name.
- Need
Support float64Ipv6 - 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
. - Postgresql
Readonly stringInstance Id - ID of the resource.
- Read
Only stringGroup Id - RO group ID.
- Voucher
Ids []string - Specify Voucher Ids if
auto_voucher
was1
, only support using 1 vouchers for now. - Wait
Switch 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 thememory
,storage
,cpu
fields.
- db
Version String - PostgreSQL kernel version, which must be the same as that of the primary instance.
- master
Db StringInstance Id - 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 sourcetencentcloud.getPostgresqlSpecinfos
provides. - project
Id Double - Project ID.
- security
Groups List<String>Ids - ID of security group.
- storage Double
- Instance storage capacity in GB.
- subnet
Id String - VPC subnet ID.
- vpc
Id String - VPC ID.
- zone String
- Availability zone ID, which can be obtained through the Zone field in the returned value of the DescribeZones API.
- auto
Renew DoubleFlag - Auto renew flag,
1
for enabled. NOTES: Only support prepaid instance. - auto
Voucher Double - Whether to use voucher,
1
for enabled. - cpu Double
- Number of CPU cores. Allowed value must be equal
cpu
that data sourcetencentcloud.getPostgresqlSpecinfos
provides. - dedicated
Cluster StringId - Dedicated cluster ID.
- instance
Charge StringType - instance billing mode. Valid values: PREPAID (monthly subscription), POSTPAID_BY_HOUR (pay-as-you-go).
- name String
- Instance name.
- need
Support DoubleIpv6 - 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
. - postgresql
Readonly StringInstance Id - ID of the resource.
- read
Only StringGroup Id - RO group ID.
- voucher
Ids List<String> - Specify Voucher Ids if
auto_voucher
was1
, only support using 1 vouchers for now. - wait
Switch 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 thememory
,storage
,cpu
fields.
- db
Version string - PostgreSQL kernel version, which must be the same as that of the primary instance.
- master
Db stringInstance Id - 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 sourcetencentcloud.getPostgresqlSpecinfos
provides. - project
Id number - Project ID.
- security
Groups string[]Ids - ID of security group.
- storage number
- Instance storage capacity in GB.
- subnet
Id string - VPC subnet ID.
- vpc
Id string - VPC ID.
- zone string
- Availability zone ID, which can be obtained through the Zone field in the returned value of the DescribeZones API.
- auto
Renew numberFlag - Auto renew flag,
1
for enabled. NOTES: Only support prepaid instance. - auto
Voucher number - Whether to use voucher,
1
for enabled. - cpu number
- Number of CPU cores. Allowed value must be equal
cpu
that data sourcetencentcloud.getPostgresqlSpecinfos
provides. - dedicated
Cluster stringId - Dedicated cluster ID.
- instance
Charge stringType - instance billing mode. Valid values: PREPAID (monthly subscription), POSTPAID_BY_HOUR (pay-as-you-go).
- name string
- Instance name.
- need
Support numberIpv6 - 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
. - postgresql
Readonly stringInstance Id - ID of the resource.
- read
Only stringGroup Id - RO group ID.
- voucher
Ids string[] - Specify Voucher Ids if
auto_voucher
was1
, only support using 1 vouchers for now. - wait
Switch 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 thememory
,storage
,cpu
fields.
- db_
version str - PostgreSQL kernel version, which must be the same as that of the primary instance.
- master_
db_ strinstance_ id - 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 sourcetencentcloud.getPostgresqlSpecinfos
provides. - project_
id float - Project ID.
- security_
groups_ Sequence[str]ids - ID of security group.
- storage float
- Instance storage capacity in GB.
- subnet_
id str - VPC subnet ID.
- vpc_
id str - VPC ID.
- zone str
- Availability zone ID, which can be obtained through the Zone field in the returned value of the DescribeZones API.
- auto_
renew_ floatflag - 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 sourcetencentcloud.getPostgresqlSpecinfos
provides. - dedicated_
cluster_ strid - Dedicated cluster ID.
- instance_
charge_ strtype - instance billing mode. Valid values: PREPAID (monthly subscription), POSTPAID_BY_HOUR (pay-as-you-go).
- name str
- Instance name.
- need_
support_ floatipv6 - 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_ strinstance_ id - ID of the resource.
- read_
only_ strgroup_ id - RO group ID.
- voucher_
ids Sequence[str] - Specify Voucher Ids if
auto_voucher
was1
, 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 thememory
,storage
,cpu
fields.
- db
Version String - PostgreSQL kernel version, which must be the same as that of the primary instance.
- master
Db StringInstance Id - 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 sourcetencentcloud.getPostgresqlSpecinfos
provides. - project
Id Number - Project ID.
- security
Groups List<String>Ids - ID of security group.
- storage Number
- Instance storage capacity in GB.
- subnet
Id String - VPC subnet ID.
- vpc
Id String - VPC ID.
- zone String
- Availability zone ID, which can be obtained through the Zone field in the returned value of the DescribeZones API.
- auto
Renew NumberFlag - Auto renew flag,
1
for enabled. NOTES: Only support prepaid instance. - auto
Voucher Number - Whether to use voucher,
1
for enabled. - cpu Number
- Number of CPU cores. Allowed value must be equal
cpu
that data sourcetencentcloud.getPostgresqlSpecinfos
provides. - dedicated
Cluster StringId - Dedicated cluster ID.
- instance
Charge StringType - instance billing mode. Valid values: PREPAID (monthly subscription), POSTPAID_BY_HOUR (pay-as-you-go).
- name String
- Instance name.
- need
Support NumberIpv6 - 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
. - postgresql
Readonly StringInstance Id - ID of the resource.
- read
Only StringGroup Id - RO group ID.
- voucher
Ids List<String> - Specify Voucher Ids if
auto_voucher
was1
, only support using 1 vouchers for now. - wait
Switch 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 thememory
,storage
,cpu
fields.
Outputs
All input properties are implicitly available as output properties. Additionally, the PostgresqlReadonlyInstance resource produces the following output properties:
- Create
Time string - Create time of the postgresql instance.
- Id string
- The provider-assigned unique ID for this managed resource.
- Instance
Id string - The instance ID of this readonly resource.
- Private
Access stringIp - IP for private access.
- Private
Access doublePort - Port for private access.
- Create
Time string - Create time of the postgresql instance.
- Id string
- The provider-assigned unique ID for this managed resource.
- Instance
Id string - The instance ID of this readonly resource.
- Private
Access stringIp - IP for private access.
- Private
Access float64Port - Port for private access.
- create
Time String - Create time of the postgresql instance.
- id String
- The provider-assigned unique ID for this managed resource.
- instance
Id String - The instance ID of this readonly resource.
- private
Access StringIp - IP for private access.
- private
Access DoublePort - Port for private access.
- create
Time string - Create time of the postgresql instance.
- id string
- The provider-assigned unique ID for this managed resource.
- instance
Id string - The instance ID of this readonly resource.
- private
Access stringIp - IP for private access.
- private
Access numberPort - 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_ strip - IP for private access.
- private_
access_ floatport - Port for private access.
- create
Time String - Create time of the postgresql instance.
- id String
- The provider-assigned unique ID for this managed resource.
- instance
Id String - The instance ID of this readonly resource.
- private
Access StringIp - IP for private access.
- private
Access NumberPort - 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
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Auto
Renew doubleFlag - Auto renew flag,
1
for enabled. NOTES: Only support prepaid instance. - Auto
Voucher double - Whether to use voucher,
1
for enabled. - Cpu double
- Number of CPU cores. Allowed value must be equal
cpu
that data sourcetencentcloud.getPostgresqlSpecinfos
provides. - Create
Time string - Create time of the postgresql instance.
- Db
Version string - PostgreSQL kernel version, which must be the same as that of the primary instance.
- Dedicated
Cluster stringId - Dedicated cluster ID.
- Instance
Charge stringType - instance billing mode. Valid values: PREPAID (monthly subscription), POSTPAID_BY_HOUR (pay-as-you-go).
- Instance
Id string - The instance ID of this readonly resource.
- Master
Db stringInstance Id - 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 sourcetencentcloud.getPostgresqlSpecinfos
provides. - Name string
- Instance name.
- Need
Support doubleIpv6 - 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
. - Postgresql
Readonly stringInstance Id - ID of the resource.
- Private
Access stringIp - IP for private access.
- Private
Access doublePort - Port for private access.
- Project
Id double - Project ID.
- Read
Only stringGroup Id - RO group ID.
- Security
Groups List<string>Ids - ID of security group.
- Storage double
- Instance storage capacity in GB.
- Subnet
Id string - VPC subnet ID.
- Voucher
Ids List<string> - Specify Voucher Ids if
auto_voucher
was1
, only support using 1 vouchers for now. - Vpc
Id string - VPC ID.
- Wait
Switch 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 thememory
,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 float64Flag - Auto renew flag,
1
for enabled. NOTES: Only support prepaid instance. - Auto
Voucher float64 - Whether to use voucher,
1
for enabled. - Cpu float64
- Number of CPU cores. Allowed value must be equal
cpu
that data sourcetencentcloud.getPostgresqlSpecinfos
provides. - Create
Time string - Create time of the postgresql instance.
- Db
Version string - PostgreSQL kernel version, which must be the same as that of the primary instance.
- Dedicated
Cluster stringId - Dedicated cluster ID.
- Instance
Charge stringType - instance billing mode. Valid values: PREPAID (monthly subscription), POSTPAID_BY_HOUR (pay-as-you-go).
- Instance
Id string - The instance ID of this readonly resource.
- Master
Db stringInstance Id - 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 sourcetencentcloud.getPostgresqlSpecinfos
provides. - Name string
- Instance name.
- Need
Support float64Ipv6 - 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
. - Postgresql
Readonly stringInstance Id - ID of the resource.
- Private
Access stringIp - IP for private access.
- Private
Access float64Port - Port for private access.
- Project
Id float64 - Project ID.
- Read
Only stringGroup Id - RO group ID.
- Security
Groups []stringIds - ID of security group.
- Storage float64
- Instance storage capacity in GB.
- Subnet
Id string - VPC subnet ID.
- Voucher
Ids []string - Specify Voucher Ids if
auto_voucher
was1
, only support using 1 vouchers for now. - Vpc
Id string - VPC ID.
- Wait
Switch 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 thememory
,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 DoubleFlag - Auto renew flag,
1
for enabled. NOTES: Only support prepaid instance. - auto
Voucher Double - Whether to use voucher,
1
for enabled. - cpu Double
- Number of CPU cores. Allowed value must be equal
cpu
that data sourcetencentcloud.getPostgresqlSpecinfos
provides. - create
Time String - Create time of the postgresql instance.
- db
Version String - PostgreSQL kernel version, which must be the same as that of the primary instance.
- dedicated
Cluster StringId - Dedicated cluster ID.
- instance
Charge StringType - instance billing mode. Valid values: PREPAID (monthly subscription), POSTPAID_BY_HOUR (pay-as-you-go).
- instance
Id String - The instance ID of this readonly resource.
- master
Db StringInstance Id - 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 sourcetencentcloud.getPostgresqlSpecinfos
provides. - name String
- Instance name.
- need
Support DoubleIpv6 - 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
. - postgresql
Readonly StringInstance Id - ID of the resource.
- private
Access StringIp - IP for private access.
- private
Access DoublePort - Port for private access.
- project
Id Double - Project ID.
- read
Only StringGroup Id - RO group ID.
- security
Groups List<String>Ids - ID of security group.
- storage Double
- Instance storage capacity in GB.
- subnet
Id String - VPC subnet ID.
- voucher
Ids List<String> - Specify Voucher Ids if
auto_voucher
was1
, only support using 1 vouchers for now. - vpc
Id String - VPC ID.
- wait
Switch 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 thememory
,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 numberFlag - Auto renew flag,
1
for enabled. NOTES: Only support prepaid instance. - auto
Voucher number - Whether to use voucher,
1
for enabled. - cpu number
- Number of CPU cores. Allowed value must be equal
cpu
that data sourcetencentcloud.getPostgresqlSpecinfos
provides. - create
Time string - Create time of the postgresql instance.
- db
Version string - PostgreSQL kernel version, which must be the same as that of the primary instance.
- dedicated
Cluster stringId - Dedicated cluster ID.
- instance
Charge stringType - instance billing mode. Valid values: PREPAID (monthly subscription), POSTPAID_BY_HOUR (pay-as-you-go).
- instance
Id string - The instance ID of this readonly resource.
- master
Db stringInstance Id - 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 sourcetencentcloud.getPostgresqlSpecinfos
provides. - name string
- Instance name.
- need
Support numberIpv6 - 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
. - postgresql
Readonly stringInstance Id - ID of the resource.
- private
Access stringIp - IP for private access.
- private
Access numberPort - Port for private access.
- project
Id number - Project ID.
- read
Only stringGroup Id - RO group ID.
- security
Groups string[]Ids - ID of security group.
- storage number
- Instance storage capacity in GB.
- subnet
Id string - VPC subnet ID.
- voucher
Ids string[] - Specify Voucher Ids if
auto_voucher
was1
, only support using 1 vouchers for now. - vpc
Id string - VPC ID.
- wait
Switch 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 thememory
,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_ floatflag - 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 sourcetencentcloud.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_ strid - Dedicated cluster ID.
- instance_
charge_ strtype - 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_ strinstance_ id - 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 sourcetencentcloud.getPostgresqlSpecinfos
provides. - name str
- Instance name.
- need_
support_ floatipv6 - 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_ strinstance_ id - ID of the resource.
- private_
access_ strip - IP for private access.
- private_
access_ floatport - Port for private access.
- project_
id float - Project ID.
- read_
only_ strgroup_ id - RO group ID.
- security_
groups_ Sequence[str]ids - 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
was1
, 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 thememory
,storage
,cpu
fields. - zone str
- Availability zone ID, which can be obtained through the Zone field in the returned value of the DescribeZones API.
- auto
Renew NumberFlag - Auto renew flag,
1
for enabled. NOTES: Only support prepaid instance. - auto
Voucher Number - Whether to use voucher,
1
for enabled. - cpu Number
- Number of CPU cores. Allowed value must be equal
cpu
that data sourcetencentcloud.getPostgresqlSpecinfos
provides. - create
Time String - Create time of the postgresql instance.
- db
Version String - PostgreSQL kernel version, which must be the same as that of the primary instance.
- dedicated
Cluster StringId - Dedicated cluster ID.
- instance
Charge StringType - instance billing mode. Valid values: PREPAID (monthly subscription), POSTPAID_BY_HOUR (pay-as-you-go).
- instance
Id String - The instance ID of this readonly resource.
- master
Db StringInstance Id - 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 sourcetencentcloud.getPostgresqlSpecinfos
provides. - name String
- Instance name.
- need
Support NumberIpv6 - 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
. - postgresql
Readonly StringInstance Id - ID of the resource.
- private
Access StringIp - IP for private access.
- private
Access NumberPort - Port for private access.
- project
Id Number - Project ID.
- read
Only StringGroup Id - RO group ID.
- security
Groups List<String>Ids - ID of security group.
- storage Number
- Instance storage capacity in GB.
- subnet
Id String - VPC subnet ID.
- voucher
Ids List<String> - Specify Voucher Ids if
auto_voucher
was1
, only support using 1 vouchers for now. - vpc
Id String - VPC ID.
- wait
Switch 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 thememory
,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
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.