published on Monday, Jun 15, 2026 by tencentcloudstack
published on Monday, Jun 15, 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:
- 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 doubleDay - Audit log retention days. Valid values: 7, 30, 90, 180, 365, 1095, 1825.
- Mongodb
Audit stringService Id - ID of the resource.
- Rule
Filters List<MongodbAudit Service Rule Filter> - Audit filter rules. Only required when audit_all is false.
- Timeouts
Mongodb
Audit Service Timeouts
- 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 float64Day - Audit log retention days. Valid values: 7, 30, 90, 180, 365, 1095, 1825.
- Mongodb
Audit stringService Id - ID of the resource.
- Rule
Filters []MongodbAudit Service Rule Filter Args - Audit filter rules. Only required when audit_all is false.
- Timeouts
Mongodb
Audit Service Timeouts Args
- 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_ numberday - Audit log retention days. Valid values: 7, 30, 90, 180, 365, 1095, 1825.
- mongodb_
audit_ stringservice_ id - ID of the resource.
- rule_
filters list(object) - Audit filter rules. Only required when audit_all is false.
- timeouts object
- audit
All Boolean - 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 DoubleDay - Audit log retention days. Valid values: 7, 30, 90, 180, 365, 1095, 1825.
- mongodb
Audit StringService Id - ID of the resource.
- rule
Filters List<MongodbAudit Service Rule Filter> - Audit filter rules. Only required when audit_all is false.
- timeouts
Mongodb
Audit Service Timeouts
- audit
All boolean - 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 numberDay - Audit log retention days. Valid values: 7, 30, 90, 180, 365, 1095, 1825.
- mongodb
Audit stringService Id - ID of the resource.
- rule
Filters MongodbAudit Service Rule Filter[] - Audit filter rules. Only required when audit_all is false.
- timeouts
Mongodb
Audit Service Timeouts
- 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_ floatday - Audit log retention days. Valid values: 7, 30, 90, 180, 365, 1095, 1825.
- mongodb_
audit_ strservice_ id - ID of the resource.
- rule_
filters Sequence[MongodbAudit Service Rule Filter Args] - Audit filter rules. Only required when audit_all is false.
- timeouts
Mongodb
Audit Service Timeouts Args
- audit
All Boolean - 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 NumberDay - Audit log retention days. Valid values: 7, 30, 90, 180, 365, 1095, 1825.
- mongodb
Audit StringService Id - ID of the resource.
- rule
Filters 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.
- Instance
Name string - Instance name.
- Log
Type 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.
- instance_
name string - Instance name.
- log_
type 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.
- instance
Name string - Instance name.
- log
Type 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.
- instance
Name String - Instance name.
- log
Type 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) -> MongodbAuditServicefunc 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.
- 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 doubleDay - Audit log retention days. Valid values: 7, 30, 90, 180, 365, 1095, 1825.
- Log
Type string - Audit log storage type.
- Mongodb
Audit stringService Id - ID of the resource.
- Rule
Filters List<MongodbAudit Service Rule Filter> - Audit filter rules. Only required when audit_all is false.
- Timeouts
Mongodb
Audit Service Timeouts
- 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 float64Day - Audit log retention days. Valid values: 7, 30, 90, 180, 365, 1095, 1825.
- Log
Type string - Audit log storage type.
- Mongodb
Audit stringService Id - ID of the resource.
- Rule
Filters []MongodbAudit Service Rule Filter Args - Audit filter rules. Only required when audit_all is false.
- Timeouts
Mongodb
Audit Service Timeouts Args
- 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_ numberday - Audit log retention days. Valid values: 7, 30, 90, 180, 365, 1095, 1825.
- log_
type string - Audit log storage type.
- mongodb_
audit_ stringservice_ id - ID of the resource.
- rule_
filters list(object) - Audit filter rules. Only required when audit_all is false.
- timeouts object
- audit
All Boolean - 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 DoubleDay - Audit log retention days. Valid values: 7, 30, 90, 180, 365, 1095, 1825.
- log
Type String - Audit log storage type.
- mongodb
Audit StringService Id - ID of the resource.
- rule
Filters List<MongodbAudit Service Rule Filter> - Audit filter rules. Only required when audit_all is false.
- timeouts
Mongodb
Audit Service Timeouts
- audit
All boolean - 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 numberDay - Audit log retention days. Valid values: 7, 30, 90, 180, 365, 1095, 1825.
- log
Type string - Audit log storage type.
- mongodb
Audit stringService Id - ID of the resource.
- rule
Filters MongodbAudit Service Rule Filter[] - Audit filter rules. Only required when audit_all is false.
- timeouts
Mongodb
Audit Service Timeouts
- 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_ floatday - Audit log retention days. Valid values: 7, 30, 90, 180, 365, 1095, 1825.
- log_
type str - Audit log storage type.
- mongodb_
audit_ strservice_ id - ID of the resource.
- rule_
filters Sequence[MongodbAudit Service Rule Filter Args] - Audit filter rules. Only required when audit_all is false.
- timeouts
Mongodb
Audit Service Timeouts Args
- audit
All Boolean - 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 NumberDay - Audit log retention days. Valid values: 7, 30, 90, 180, 365, 1095, 1825.
- log
Type String - Audit log storage type.
- mongodb
Audit StringService Id - ID of the resource.
- rule
Filters List<Property Map> - Audit filter rules. Only required when audit_all is false.
- timeouts Property Map
Supporting Types
MongodbAuditServiceRuleFilter, MongodbAuditServiceRuleFilterArgs
MongodbAuditServiceTimeouts, MongodbAuditServiceTimeoutsArgs
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
tencentcloudTerraform Provider.
published on Monday, Jun 15, 2026 by tencentcloudstack