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

tencentcloud.PostgresqlSecurityGroupConfig

Explore with Pulumi AI

Provides a resource to create a postgresql security_group_config

Example Usage

Set security group for the sepcified postgres instance

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

const securityGroupConfig = new tencentcloud.PostgresqlSecurityGroupConfig("securityGroupConfig", {
    securityGroupIdSets: [
        local.sg_id,
        local.sg_id2,
    ],
    dbInstanceId: local.pgsql_id,
});
Copy
import pulumi
import pulumi_tencentcloud as tencentcloud

security_group_config = tencentcloud.PostgresqlSecurityGroupConfig("securityGroupConfig",
    security_group_id_sets=[
        local["sg_id"],
        local["sg_id2"],
    ],
    db_instance_id=local["pgsql_id"])
Copy
package main

import (
	"github.com/pulumi/pulumi-terraform-provider/sdks/go/tencentcloud/tencentcloud"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := tencentcloud.NewPostgresqlSecurityGroupConfig(ctx, "securityGroupConfig", &tencentcloud.PostgresqlSecurityGroupConfigArgs{
			SecurityGroupIdSets: pulumi.StringArray{
				local.Sg_id,
				local.Sg_id2,
			},
			DbInstanceId: pulumi.Any(local.Pgsql_id),
		})
		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 securityGroupConfig = new Tencentcloud.PostgresqlSecurityGroupConfig("securityGroupConfig", new()
    {
        SecurityGroupIdSets = new[]
        {
            local.Sg_id,
            local.Sg_id2,
        },
        DbInstanceId = local.Pgsql_id,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.tencentcloud.PostgresqlSecurityGroupConfig;
import com.pulumi.tencentcloud.PostgresqlSecurityGroupConfigArgs;
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) {
        var securityGroupConfig = new PostgresqlSecurityGroupConfig("securityGroupConfig", PostgresqlSecurityGroupConfigArgs.builder()
            .securityGroupIdSets(            
                local.sg_id(),
                local.sg_id2())
            .dbInstanceId(local.pgsql_id())
            .build());

    }
}
Copy
resources:
  securityGroupConfig:
    type: tencentcloud:PostgresqlSecurityGroupConfig
    properties:
      securityGroupIdSets:
        - ${local.sg_id}
        - ${local.sg_id2}
      dbInstanceId: ${local.pgsql_id}
Copy

Set security group for the specified readonly group

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

const group = new tencentcloud.PostgresqlReadonlyGroup("group", {
    masterDbInstanceId: local.pgsql_id,
    projectId: 0,
    subnetId: local.subnet_id,
    vpcId: local.vpc_id,
    replayLagEliminate: 1,
    replayLatencyEliminate: 1,
    maxReplayLag: 100,
    maxReplayLatency: 512,
    minDelayEliminateReserve: 1,
});
const securityGroupConfig = new tencentcloud.PostgresqlSecurityGroupConfig("securityGroupConfig", {
    securityGroupIdSets: [
        local.sg_id,
        local.sg_id2,
    ],
    readOnlyGroupId: group.postgresqlReadonlyGroupId,
});
Copy
import pulumi
import pulumi_tencentcloud as tencentcloud

group = tencentcloud.PostgresqlReadonlyGroup("group",
    master_db_instance_id=local["pgsql_id"],
    project_id=0,
    subnet_id=local["subnet_id"],
    vpc_id=local["vpc_id"],
    replay_lag_eliminate=1,
    replay_latency_eliminate=1,
    max_replay_lag=100,
    max_replay_latency=512,
    min_delay_eliminate_reserve=1)
security_group_config = tencentcloud.PostgresqlSecurityGroupConfig("securityGroupConfig",
    security_group_id_sets=[
        local["sg_id"],
        local["sg_id2"],
    ],
    read_only_group_id=group.postgresql_readonly_group_id)
Copy
package main

import (
	"github.com/pulumi/pulumi-terraform-provider/sdks/go/tencentcloud/tencentcloud"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		group, err := tencentcloud.NewPostgresqlReadonlyGroup(ctx, "group", &tencentcloud.PostgresqlReadonlyGroupArgs{
			MasterDbInstanceId:       pulumi.Any(local.Pgsql_id),
			ProjectId:                pulumi.Float64(0),
			SubnetId:                 pulumi.Any(local.Subnet_id),
			VpcId:                    pulumi.Any(local.Vpc_id),
			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
		}
		_, err = tencentcloud.NewPostgresqlSecurityGroupConfig(ctx, "securityGroupConfig", &tencentcloud.PostgresqlSecurityGroupConfigArgs{
			SecurityGroupIdSets: pulumi.StringArray{
				local.Sg_id,
				local.Sg_id2,
			},
			ReadOnlyGroupId: group.PostgresqlReadonlyGroupId,
		})
		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 @group = new Tencentcloud.PostgresqlReadonlyGroup("group", new()
    {
        MasterDbInstanceId = local.Pgsql_id,
        ProjectId = 0,
        SubnetId = local.Subnet_id,
        VpcId = local.Vpc_id,
        ReplayLagEliminate = 1,
        ReplayLatencyEliminate = 1,
        MaxReplayLag = 100,
        MaxReplayLatency = 512,
        MinDelayEliminateReserve = 1,
    });

    var securityGroupConfig = new Tencentcloud.PostgresqlSecurityGroupConfig("securityGroupConfig", new()
    {
        SecurityGroupIdSets = new[]
        {
            local.Sg_id,
            local.Sg_id2,
        },
        ReadOnlyGroupId = @group.PostgresqlReadonlyGroupId,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.tencentcloud.PostgresqlReadonlyGroup;
import com.pulumi.tencentcloud.PostgresqlReadonlyGroupArgs;
import com.pulumi.tencentcloud.PostgresqlSecurityGroupConfig;
import com.pulumi.tencentcloud.PostgresqlSecurityGroupConfigArgs;
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) {
        var group = new PostgresqlReadonlyGroup("group", PostgresqlReadonlyGroupArgs.builder()
            .masterDbInstanceId(local.pgsql_id())
            .projectId(0)
            .subnetId(local.subnet_id())
            .vpcId(local.vpc_id())
            .replayLagEliminate(1)
            .replayLatencyEliminate(1)
            .maxReplayLag(100)
            .maxReplayLatency(512)
            .minDelayEliminateReserve(1)
            .build());

        var securityGroupConfig = new PostgresqlSecurityGroupConfig("securityGroupConfig", PostgresqlSecurityGroupConfigArgs.builder()
            .securityGroupIdSets(            
                local.sg_id(),
                local.sg_id2())
            .readOnlyGroupId(group.postgresqlReadonlyGroupId())
            .build());

    }
}
Copy
resources:
  group:
    type: tencentcloud:PostgresqlReadonlyGroup
    properties:
      masterDbInstanceId: ${local.pgsql_id}
      projectId: 0
      subnetId: ${local.subnet_id}
      vpcId: ${local.vpc_id}
      replayLagEliminate: 1
      replayLatencyEliminate: 1
      maxReplayLag: 100
      maxReplayLatency: 512
      minDelayEliminateReserve: 1
  securityGroupConfig:
    type: tencentcloud:PostgresqlSecurityGroupConfig
    properties:
      securityGroupIdSets:
        - ${local.sg_id}
        - ${local.sg_id2}
      readOnlyGroupId: ${group.postgresqlReadonlyGroupId}
Copy

Create PostgresqlSecurityGroupConfig Resource

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

Constructor syntax

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

@overload
def PostgresqlSecurityGroupConfig(resource_name: str,
                                  opts: Optional[ResourceOptions] = None,
                                  security_group_id_sets: Optional[Sequence[str]] = None,
                                  db_instance_id: Optional[str] = None,
                                  postgresql_security_group_config_id: Optional[str] = None,
                                  read_only_group_id: Optional[str] = None)
func NewPostgresqlSecurityGroupConfig(ctx *Context, name string, args PostgresqlSecurityGroupConfigArgs, opts ...ResourceOption) (*PostgresqlSecurityGroupConfig, error)
public PostgresqlSecurityGroupConfig(string name, PostgresqlSecurityGroupConfigArgs args, CustomResourceOptions? opts = null)
public PostgresqlSecurityGroupConfig(String name, PostgresqlSecurityGroupConfigArgs args)
public PostgresqlSecurityGroupConfig(String name, PostgresqlSecurityGroupConfigArgs args, CustomResourceOptions options)
type: tencentcloud:PostgresqlSecurityGroupConfig
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. PostgresqlSecurityGroupConfigArgs
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. PostgresqlSecurityGroupConfigArgs
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. PostgresqlSecurityGroupConfigArgs
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. PostgresqlSecurityGroupConfigArgs
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. PostgresqlSecurityGroupConfigArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

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

SecurityGroupIdSets This property is required. List<string>
Information of security groups in array.
DbInstanceId string
Instance ID. Either this parameter or ReadOnlyGroupId must be passed in. If both parameters are passed in, ReadOnlyGroupId will be ignored.
PostgresqlSecurityGroupConfigId string
ID of the resource.
ReadOnlyGroupId string
RO group ID. Either this parameter or DBInstanceId must be passed in. To query the security groups associated with the RO groups, only pass in ReadOnlyGroupId.
SecurityGroupIdSets This property is required. []string
Information of security groups in array.
DbInstanceId string
Instance ID. Either this parameter or ReadOnlyGroupId must be passed in. If both parameters are passed in, ReadOnlyGroupId will be ignored.
PostgresqlSecurityGroupConfigId string
ID of the resource.
ReadOnlyGroupId string
RO group ID. Either this parameter or DBInstanceId must be passed in. To query the security groups associated with the RO groups, only pass in ReadOnlyGroupId.
securityGroupIdSets This property is required. List<String>
Information of security groups in array.
dbInstanceId String
Instance ID. Either this parameter or ReadOnlyGroupId must be passed in. If both parameters are passed in, ReadOnlyGroupId will be ignored.
postgresqlSecurityGroupConfigId String
ID of the resource.
readOnlyGroupId String
RO group ID. Either this parameter or DBInstanceId must be passed in. To query the security groups associated with the RO groups, only pass in ReadOnlyGroupId.
securityGroupIdSets This property is required. string[]
Information of security groups in array.
dbInstanceId string
Instance ID. Either this parameter or ReadOnlyGroupId must be passed in. If both parameters are passed in, ReadOnlyGroupId will be ignored.
postgresqlSecurityGroupConfigId string
ID of the resource.
readOnlyGroupId string
RO group ID. Either this parameter or DBInstanceId must be passed in. To query the security groups associated with the RO groups, only pass in ReadOnlyGroupId.
security_group_id_sets This property is required. Sequence[str]
Information of security groups in array.
db_instance_id str
Instance ID. Either this parameter or ReadOnlyGroupId must be passed in. If both parameters are passed in, ReadOnlyGroupId will be ignored.
postgresql_security_group_config_id str
ID of the resource.
read_only_group_id str
RO group ID. Either this parameter or DBInstanceId must be passed in. To query the security groups associated with the RO groups, only pass in ReadOnlyGroupId.
securityGroupIdSets This property is required. List<String>
Information of security groups in array.
dbInstanceId String
Instance ID. Either this parameter or ReadOnlyGroupId must be passed in. If both parameters are passed in, ReadOnlyGroupId will be ignored.
postgresqlSecurityGroupConfigId String
ID of the resource.
readOnlyGroupId String
RO group ID. Either this parameter or DBInstanceId must be passed in. To query the security groups associated with the RO groups, only pass in ReadOnlyGroupId.

Outputs

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

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.

Look up Existing PostgresqlSecurityGroupConfig Resource

Get an existing PostgresqlSecurityGroupConfig 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?: PostgresqlSecurityGroupConfigState, opts?: CustomResourceOptions): PostgresqlSecurityGroupConfig
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        db_instance_id: Optional[str] = None,
        postgresql_security_group_config_id: Optional[str] = None,
        read_only_group_id: Optional[str] = None,
        security_group_id_sets: Optional[Sequence[str]] = None) -> PostgresqlSecurityGroupConfig
func GetPostgresqlSecurityGroupConfig(ctx *Context, name string, id IDInput, state *PostgresqlSecurityGroupConfigState, opts ...ResourceOption) (*PostgresqlSecurityGroupConfig, error)
public static PostgresqlSecurityGroupConfig Get(string name, Input<string> id, PostgresqlSecurityGroupConfigState? state, CustomResourceOptions? opts = null)
public static PostgresqlSecurityGroupConfig get(String name, Output<String> id, PostgresqlSecurityGroupConfigState state, CustomResourceOptions options)
resources:  _:    type: tencentcloud:PostgresqlSecurityGroupConfig    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:
DbInstanceId string
Instance ID. Either this parameter or ReadOnlyGroupId must be passed in. If both parameters are passed in, ReadOnlyGroupId will be ignored.
PostgresqlSecurityGroupConfigId string
ID of the resource.
ReadOnlyGroupId string
RO group ID. Either this parameter or DBInstanceId must be passed in. To query the security groups associated with the RO groups, only pass in ReadOnlyGroupId.
SecurityGroupIdSets List<string>
Information of security groups in array.
DbInstanceId string
Instance ID. Either this parameter or ReadOnlyGroupId must be passed in. If both parameters are passed in, ReadOnlyGroupId will be ignored.
PostgresqlSecurityGroupConfigId string
ID of the resource.
ReadOnlyGroupId string
RO group ID. Either this parameter or DBInstanceId must be passed in. To query the security groups associated with the RO groups, only pass in ReadOnlyGroupId.
SecurityGroupIdSets []string
Information of security groups in array.
dbInstanceId String
Instance ID. Either this parameter or ReadOnlyGroupId must be passed in. If both parameters are passed in, ReadOnlyGroupId will be ignored.
postgresqlSecurityGroupConfigId String
ID of the resource.
readOnlyGroupId String
RO group ID. Either this parameter or DBInstanceId must be passed in. To query the security groups associated with the RO groups, only pass in ReadOnlyGroupId.
securityGroupIdSets List<String>
Information of security groups in array.
dbInstanceId string
Instance ID. Either this parameter or ReadOnlyGroupId must be passed in. If both parameters are passed in, ReadOnlyGroupId will be ignored.
postgresqlSecurityGroupConfigId string
ID of the resource.
readOnlyGroupId string
RO group ID. Either this parameter or DBInstanceId must be passed in. To query the security groups associated with the RO groups, only pass in ReadOnlyGroupId.
securityGroupIdSets string[]
Information of security groups in array.
db_instance_id str
Instance ID. Either this parameter or ReadOnlyGroupId must be passed in. If both parameters are passed in, ReadOnlyGroupId will be ignored.
postgresql_security_group_config_id str
ID of the resource.
read_only_group_id str
RO group ID. Either this parameter or DBInstanceId must be passed in. To query the security groups associated with the RO groups, only pass in ReadOnlyGroupId.
security_group_id_sets Sequence[str]
Information of security groups in array.
dbInstanceId String
Instance ID. Either this parameter or ReadOnlyGroupId must be passed in. If both parameters are passed in, ReadOnlyGroupId will be ignored.
postgresqlSecurityGroupConfigId String
ID of the resource.
readOnlyGroupId String
RO group ID. Either this parameter or DBInstanceId must be passed in. To query the security groups associated with the RO groups, only pass in ReadOnlyGroupId.
securityGroupIdSets List<String>
Information of security groups in array.

Package Details

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