1. Packages
  2. Packages
  3. Tencentcloud Provider
  4. API Docs
  5. MongodbAuditService
Viewing docs for tencentcloud 1.83.4
published on Monday, Jun 22, 2026 by tencentcloudstack
Viewing docs for tencentcloud 1.83.4
published on Monday, Jun 22, 2026 by tencentcloudstack

    Provides a resource to manage MongoDB audit service.

    Example Usage

    Full audit mode

    import * as pulumi from "@pulumi/pulumi";
    import * as tencentcloud from "@pulumi/tencentcloud";
    
    const example = new tencentcloud.MongodbAuditService("example", {
        instanceId: "cmgo-5aqo4yf7",
        logExpireDay: 7,
        auditAll: true,
    });
    
    import pulumi
    import pulumi_tencentcloud as tencentcloud
    
    example = tencentcloud.MongodbAuditService("example",
        instance_id="cmgo-5aqo4yf7",
        log_expire_day=7,
        audit_all=True)
    
    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.NewMongodbAuditService(ctx, "example", &tencentcloud.MongodbAuditServiceArgs{
    			InstanceId:   pulumi.String("cmgo-5aqo4yf7"),
    			LogExpireDay: pulumi.Float64(7),
    			AuditAll:     pulumi.Bool(true),
    		})
    		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 example = new Tencentcloud.MongodbAuditService("example", new()
        {
            InstanceId = "cmgo-5aqo4yf7",
            LogExpireDay = 7,
            AuditAll = true,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.tencentcloud.MongodbAuditService;
    import com.pulumi.tencentcloud.MongodbAuditServiceArgs;
    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 example = new MongodbAuditService("example", MongodbAuditServiceArgs.builder()
                .instanceId("cmgo-5aqo4yf7")
                .logExpireDay(7.0)
                .auditAll(true)
                .build());
    
        }
    }
    
    resources:
      example:
        type: tencentcloud:MongodbAuditService
        properties:
          instanceId: cmgo-5aqo4yf7
          logExpireDay: 7
          auditAll: true
    
    Example coming soon!
    

    Rule-based audit mode

    import * as pulumi from "@pulumi/pulumi";
    import * as tencentcloud from "@pulumi/tencentcloud";
    
    const example = new tencentcloud.MongodbAuditService("example", {
        instanceId: "cmgo-5aqo4yf7",
        logExpireDay: 30,
        auditAll: false,
        ruleFilters: [
            {
                type: "DB",
                compare: "EQ",
                values: ["testdb"],
            },
            {
                type: "User",
                compare: "EQ",
                values: ["admin"],
            },
        ],
    });
    
    import pulumi
    import pulumi_tencentcloud as tencentcloud
    
    example = tencentcloud.MongodbAuditService("example",
        instance_id="cmgo-5aqo4yf7",
        log_expire_day=30,
        audit_all=False,
        rule_filters=[
            {
                "type": "DB",
                "compare": "EQ",
                "values": ["testdb"],
            },
            {
                "type": "User",
                "compare": "EQ",
                "values": ["admin"],
            },
        ])
    
    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.NewMongodbAuditService(ctx, "example", &tencentcloud.MongodbAuditServiceArgs{
    			InstanceId:   pulumi.String("cmgo-5aqo4yf7"),
    			LogExpireDay: pulumi.Float64(30),
    			AuditAll:     pulumi.Bool(false),
    			RuleFilters: tencentcloud.MongodbAuditServiceRuleFilterArray{
    				&tencentcloud.MongodbAuditServiceRuleFilterArgs{
    					Type:    pulumi.String("DB"),
    					Compare: pulumi.String("EQ"),
    					Values: pulumi.StringArray{
    						pulumi.String("testdb"),
    					},
    				},
    				&tencentcloud.MongodbAuditServiceRuleFilterArgs{
    					Type:    pulumi.String("User"),
    					Compare: pulumi.String("EQ"),
    					Values: pulumi.StringArray{
    						pulumi.String("admin"),
    					},
    				},
    			},
    		})
    		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 example = new Tencentcloud.MongodbAuditService("example", new()
        {
            InstanceId = "cmgo-5aqo4yf7",
            LogExpireDay = 30,
            AuditAll = false,
            RuleFilters = new[]
            {
                new Tencentcloud.Inputs.MongodbAuditServiceRuleFilterArgs
                {
                    Type = "DB",
                    Compare = "EQ",
                    Values = new[]
                    {
                        "testdb",
                    },
                },
                new Tencentcloud.Inputs.MongodbAuditServiceRuleFilterArgs
                {
                    Type = "User",
                    Compare = "EQ",
                    Values = new[]
                    {
                        "admin",
                    },
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.tencentcloud.MongodbAuditService;
    import com.pulumi.tencentcloud.MongodbAuditServiceArgs;
    import com.pulumi.tencentcloud.inputs.MongodbAuditServiceRuleFilterArgs;
    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 example = new MongodbAuditService("example", MongodbAuditServiceArgs.builder()
                .instanceId("cmgo-5aqo4yf7")
                .logExpireDay(30.0)
                .auditAll(false)
                .ruleFilters(            
                    MongodbAuditServiceRuleFilterArgs.builder()
                        .type("DB")
                        .compare("EQ")
                        .values("testdb")
                        .build(),
                    MongodbAuditServiceRuleFilterArgs.builder()
                        .type("User")
                        .compare("EQ")
                        .values("admin")
                        .build())
                .build());
    
        }
    }
    
    resources:
      example:
        type: tencentcloud:MongodbAuditService
        properties:
          instanceId: cmgo-5aqo4yf7
          logExpireDay: 30
          auditAll: false
          ruleFilters:
            - type: DB
              compare: EQ
              values:
                - testdb
            - type: User
              compare: EQ
              values:
                - admin
    
    Example coming soon!
    

    Create MongodbAuditService Resource

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

    Constructor syntax

    new MongodbAuditService(name: string, args: MongodbAuditServiceArgs, opts?: CustomResourceOptions);
    @overload
    def MongodbAuditService(resource_name: str,
                            args: MongodbAuditServiceArgs,
                            opts: Optional[ResourceOptions] = None)
    
    @overload
    def MongodbAuditService(resource_name: str,
                            opts: Optional[ResourceOptions] = None,
                            audit_all: Optional[bool] = None,
                            instance_id: Optional[str] = None,
                            log_expire_day: Optional[float] = None,
                            mongodb_audit_service_id: Optional[str] = None,
                            rule_filters: Optional[Sequence[MongodbAuditServiceRuleFilterArgs]] = None,
                            timeouts: Optional[MongodbAuditServiceTimeoutsArgs] = None)
    func NewMongodbAuditService(ctx *Context, name string, args MongodbAuditServiceArgs, opts ...ResourceOption) (*MongodbAuditService, error)
    public MongodbAuditService(string name, MongodbAuditServiceArgs args, CustomResourceOptions? opts = null)
    public MongodbAuditService(String name, MongodbAuditServiceArgs args)
    public MongodbAuditService(String name, MongodbAuditServiceArgs args, CustomResourceOptions options)
    
    type: tencentcloud:MongodbAuditService
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    resource "tencentcloud_mongodbauditservice" "name" {
        # resource properties
    }

    Parameters

    name string
    The unique name of the resource.
    args MongodbAuditServiceArgs
    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 MongodbAuditServiceArgs
    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 MongodbAuditServiceArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args MongodbAuditServiceArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args MongodbAuditServiceArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

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

    AuditAll bool
    Whether to enable full audit. true: full audit, false: rule-based audit. When AuditAll is true, RuleFilters is not required.
    InstanceId string
    Instance ID, for example: cmgo-xfts****.
    LogExpireDay double
    Audit log retention days. Valid values: 7, 30, 90, 180, 365, 1095, 1825.
    MongodbAuditServiceId string
    ID of the resource.
    RuleFilters List<MongodbAuditServiceRuleFilter>
    Audit filter rules. Only required when audit_all is false.
    Timeouts MongodbAuditServiceTimeouts
    AuditAll bool
    Whether to enable full audit. true: full audit, false: rule-based audit. When AuditAll is true, RuleFilters is not required.
    InstanceId string
    Instance ID, for example: cmgo-xfts****.
    LogExpireDay float64
    Audit log retention days. Valid values: 7, 30, 90, 180, 365, 1095, 1825.
    MongodbAuditServiceId string
    ID of the resource.
    RuleFilters []MongodbAuditServiceRuleFilterArgs
    Audit filter rules. Only required when audit_all is false.
    Timeouts MongodbAuditServiceTimeoutsArgs
    audit_all bool
    Whether to enable full audit. true: full audit, false: rule-based audit. When AuditAll is true, RuleFilters is not required.
    instance_id string
    Instance ID, for example: cmgo-xfts****.
    log_expire_day number
    Audit log retention days. Valid values: 7, 30, 90, 180, 365, 1095, 1825.
    mongodb_audit_service_id string
    ID of the resource.
    rule_filters list(object)
    Audit filter rules. Only required when audit_all is false.
    timeouts object
    auditAll Boolean
    Whether to enable full audit. true: full audit, false: rule-based audit. When AuditAll is true, RuleFilters is not required.
    instanceId String
    Instance ID, for example: cmgo-xfts****.
    logExpireDay Double
    Audit log retention days. Valid values: 7, 30, 90, 180, 365, 1095, 1825.
    mongodbAuditServiceId String
    ID of the resource.
    ruleFilters List<MongodbAuditServiceRuleFilter>
    Audit filter rules. Only required when audit_all is false.
    timeouts MongodbAuditServiceTimeouts
    auditAll boolean
    Whether to enable full audit. true: full audit, false: rule-based audit. When AuditAll is true, RuleFilters is not required.
    instanceId string
    Instance ID, for example: cmgo-xfts****.
    logExpireDay number
    Audit log retention days. Valid values: 7, 30, 90, 180, 365, 1095, 1825.
    mongodbAuditServiceId string
    ID of the resource.
    ruleFilters MongodbAuditServiceRuleFilter[]
    Audit filter rules. Only required when audit_all is false.
    timeouts MongodbAuditServiceTimeouts
    audit_all bool
    Whether to enable full audit. true: full audit, false: rule-based audit. When AuditAll is true, RuleFilters is not required.
    instance_id str
    Instance ID, for example: cmgo-xfts****.
    log_expire_day float
    Audit log retention days. Valid values: 7, 30, 90, 180, 365, 1095, 1825.
    mongodb_audit_service_id str
    ID of the resource.
    rule_filters Sequence[MongodbAuditServiceRuleFilterArgs]
    Audit filter rules. Only required when audit_all is false.
    timeouts MongodbAuditServiceTimeoutsArgs
    auditAll Boolean
    Whether to enable full audit. true: full audit, false: rule-based audit. When AuditAll is true, RuleFilters is not required.
    instanceId String
    Instance ID, for example: cmgo-xfts****.
    logExpireDay Number
    Audit log retention days. Valid values: 7, 30, 90, 180, 365, 1095, 1825.
    mongodbAuditServiceId String
    ID of the resource.
    ruleFilters List<Property Map>
    Audit filter rules. Only required when audit_all is false.
    timeouts Property Map

    Outputs

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

    Id string
    The provider-assigned unique ID for this managed resource.
    InstanceName string
    Instance name.
    LogType string
    Audit log storage type.
    Id string
    The provider-assigned unique ID for this managed resource.
    InstanceName string
    Instance name.
    LogType string
    Audit log storage type.
    id string
    The provider-assigned unique ID for this managed resource.
    instance_name string
    Instance name.
    log_type string
    Audit log storage type.
    id String
    The provider-assigned unique ID for this managed resource.
    instanceName String
    Instance name.
    logType String
    Audit log storage type.
    id string
    The provider-assigned unique ID for this managed resource.
    instanceName string
    Instance name.
    logType string
    Audit log storage type.
    id str
    The provider-assigned unique ID for this managed resource.
    instance_name str
    Instance name.
    log_type str
    Audit log storage type.
    id String
    The provider-assigned unique ID for this managed resource.
    instanceName String
    Instance name.
    logType String
    Audit log storage type.

    Look up Existing MongodbAuditService Resource

    Get an existing MongodbAuditService 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?: MongodbAuditServiceState, opts?: CustomResourceOptions): MongodbAuditService
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            audit_all: Optional[bool] = None,
            instance_id: Optional[str] = None,
            instance_name: Optional[str] = None,
            log_expire_day: Optional[float] = None,
            log_type: Optional[str] = None,
            mongodb_audit_service_id: Optional[str] = None,
            rule_filters: Optional[Sequence[MongodbAuditServiceRuleFilterArgs]] = None,
            timeouts: Optional[MongodbAuditServiceTimeoutsArgs] = None) -> MongodbAuditService
    func GetMongodbAuditService(ctx *Context, name string, id IDInput, state *MongodbAuditServiceState, opts ...ResourceOption) (*MongodbAuditService, error)
    public static MongodbAuditService Get(string name, Input<string> id, MongodbAuditServiceState? state, CustomResourceOptions? opts = null)
    public static MongodbAuditService get(String name, Output<String> id, MongodbAuditServiceState state, CustomResourceOptions options)
    resources:  _:    type: tencentcloud:MongodbAuditService    get:      id: ${id}
    import {
      to = tencentcloud_mongodbauditservice.example
      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.
    The following state arguments are supported:
    AuditAll bool
    Whether to enable full audit. true: full audit, false: rule-based audit. When AuditAll is true, RuleFilters is not required.
    InstanceId string
    Instance ID, for example: cmgo-xfts****.
    InstanceName string
    Instance name.
    LogExpireDay double
    Audit log retention days. Valid values: 7, 30, 90, 180, 365, 1095, 1825.
    LogType string
    Audit log storage type.
    MongodbAuditServiceId string
    ID of the resource.
    RuleFilters List<MongodbAuditServiceRuleFilter>
    Audit filter rules. Only required when audit_all is false.
    Timeouts MongodbAuditServiceTimeouts
    AuditAll bool
    Whether to enable full audit. true: full audit, false: rule-based audit. When AuditAll is true, RuleFilters is not required.
    InstanceId string
    Instance ID, for example: cmgo-xfts****.
    InstanceName string
    Instance name.
    LogExpireDay float64
    Audit log retention days. Valid values: 7, 30, 90, 180, 365, 1095, 1825.
    LogType string
    Audit log storage type.
    MongodbAuditServiceId string
    ID of the resource.
    RuleFilters []MongodbAuditServiceRuleFilterArgs
    Audit filter rules. Only required when audit_all is false.
    Timeouts MongodbAuditServiceTimeoutsArgs
    audit_all bool
    Whether to enable full audit. true: full audit, false: rule-based audit. When AuditAll is true, RuleFilters is not required.
    instance_id string
    Instance ID, for example: cmgo-xfts****.
    instance_name string
    Instance name.
    log_expire_day number
    Audit log retention days. Valid values: 7, 30, 90, 180, 365, 1095, 1825.
    log_type string
    Audit log storage type.
    mongodb_audit_service_id string
    ID of the resource.
    rule_filters list(object)
    Audit filter rules. Only required when audit_all is false.
    timeouts object
    auditAll Boolean
    Whether to enable full audit. true: full audit, false: rule-based audit. When AuditAll is true, RuleFilters is not required.
    instanceId String
    Instance ID, for example: cmgo-xfts****.
    instanceName String
    Instance name.
    logExpireDay Double
    Audit log retention days. Valid values: 7, 30, 90, 180, 365, 1095, 1825.
    logType String
    Audit log storage type.
    mongodbAuditServiceId String
    ID of the resource.
    ruleFilters List<MongodbAuditServiceRuleFilter>
    Audit filter rules. Only required when audit_all is false.
    timeouts MongodbAuditServiceTimeouts
    auditAll boolean
    Whether to enable full audit. true: full audit, false: rule-based audit. When AuditAll is true, RuleFilters is not required.
    instanceId string
    Instance ID, for example: cmgo-xfts****.
    instanceName string
    Instance name.
    logExpireDay number
    Audit log retention days. Valid values: 7, 30, 90, 180, 365, 1095, 1825.
    logType string
    Audit log storage type.
    mongodbAuditServiceId string
    ID of the resource.
    ruleFilters MongodbAuditServiceRuleFilter[]
    Audit filter rules. Only required when audit_all is false.
    timeouts MongodbAuditServiceTimeouts
    audit_all bool
    Whether to enable full audit. true: full audit, false: rule-based audit. When AuditAll is true, RuleFilters is not required.
    instance_id str
    Instance ID, for example: cmgo-xfts****.
    instance_name str
    Instance name.
    log_expire_day float
    Audit log retention days. Valid values: 7, 30, 90, 180, 365, 1095, 1825.
    log_type str
    Audit log storage type.
    mongodb_audit_service_id str
    ID of the resource.
    rule_filters Sequence[MongodbAuditServiceRuleFilterArgs]
    Audit filter rules. Only required when audit_all is false.
    timeouts MongodbAuditServiceTimeoutsArgs
    auditAll Boolean
    Whether to enable full audit. true: full audit, false: rule-based audit. When AuditAll is true, RuleFilters is not required.
    instanceId String
    Instance ID, for example: cmgo-xfts****.
    instanceName String
    Instance name.
    logExpireDay Number
    Audit log retention days. Valid values: 7, 30, 90, 180, 365, 1095, 1825.
    logType String
    Audit log storage type.
    mongodbAuditServiceId String
    ID of the resource.
    ruleFilters List<Property Map>
    Audit filter rules. Only required when audit_all is false.
    timeouts Property Map

    Supporting Types

    MongodbAuditServiceRuleFilter, MongodbAuditServiceRuleFilterArgs

    Compare string
    Filter match type. Must be EQ.
    Type string
    Filter condition name. Valid values: SrcIp, DB, Collection, User, SqlType.
    Values List<string>
    Filter match values.
    Compare string
    Filter match type. Must be EQ.
    Type string
    Filter condition name. Valid values: SrcIp, DB, Collection, User, SqlType.
    Values []string
    Filter match values.
    compare string
    Filter match type. Must be EQ.
    type string
    Filter condition name. Valid values: SrcIp, DB, Collection, User, SqlType.
    values list(string)
    Filter match values.
    compare String
    Filter match type. Must be EQ.
    type String
    Filter condition name. Valid values: SrcIp, DB, Collection, User, SqlType.
    values List<String>
    Filter match values.
    compare string
    Filter match type. Must be EQ.
    type string
    Filter condition name. Valid values: SrcIp, DB, Collection, User, SqlType.
    values string[]
    Filter match values.
    compare str
    Filter match type. Must be EQ.
    type str
    Filter condition name. Valid values: SrcIp, DB, Collection, User, SqlType.
    values Sequence[str]
    Filter match values.
    compare String
    Filter match type. Must be EQ.
    type String
    Filter condition name. Valid values: SrcIp, DB, Collection, User, SqlType.
    values List<String>
    Filter match values.

    MongodbAuditServiceTimeouts, MongodbAuditServiceTimeoutsArgs

    Create string
    Delete string
    Create string
    Delete string
    create string
    delete string
    create String
    delete String
    create string
    delete string
    create str
    delete str
    create String
    delete String

    Import

    MongoDB audit service can be imported using the instance id, e.g.

    $ pulumi import tencentcloud:index/mongodbAuditService:MongodbAuditService example cmgo-5aqo4yf7
    

    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.
    Viewing docs for tencentcloud 1.83.4
    published on Monday, Jun 22, 2026 by tencentcloudstack

      Try Pulumi Cloud free.
      Your team will thank you.

      Start free trial