1. Packages
  2. Tencentcloud Provider
  3. API Docs
  4. MysqlAuditService
tencentcloud 1.82.29 published on Friday, Oct 10, 2025 by tencentcloudstack

tencentcloud.MysqlAuditService

Explore with Pulumi AI

tencentcloud logo
tencentcloud 1.82.29 published on Friday, Oct 10, 2025 by tencentcloudstack

    Provides a resource to create a Mysql audit service

    Example Usage

    If audit_all is true

    import * as pulumi from "@pulumi/pulumi";
    import * as tencentcloud from "@pulumi/tencentcloud";
    
    const example = new tencentcloud.MysqlAuditService("example", {
        auditAll: true,
        highLogExpireDay: 7,
        instanceId: "cdb-3kwa3gfj",
        logExpireDay: 30,
    });
    
    import pulumi
    import pulumi_tencentcloud as tencentcloud
    
    example = tencentcloud.MysqlAuditService("example",
        audit_all=True,
        high_log_expire_day=7,
        instance_id="cdb-3kwa3gfj",
        log_expire_day=30)
    
    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.NewMysqlAuditService(ctx, "example", &tencentcloud.MysqlAuditServiceArgs{
    			AuditAll:         pulumi.Bool(true),
    			HighLogExpireDay: pulumi.Float64(7),
    			InstanceId:       pulumi.String("cdb-3kwa3gfj"),
    			LogExpireDay:     pulumi.Float64(30),
    		})
    		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.MysqlAuditService("example", new()
        {
            AuditAll = true,
            HighLogExpireDay = 7,
            InstanceId = "cdb-3kwa3gfj",
            LogExpireDay = 30,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.tencentcloud.MysqlAuditService;
    import com.pulumi.tencentcloud.MysqlAuditServiceArgs;
    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 MysqlAuditService("example", MysqlAuditServiceArgs.builder()
                .auditAll(true)
                .highLogExpireDay(7)
                .instanceId("cdb-3kwa3gfj")
                .logExpireDay(30)
                .build());
    
        }
    }
    
    resources:
      example:
        type: tencentcloud:MysqlAuditService
        properties:
          auditAll: true
          highLogExpireDay: 7
          instanceId: cdb-3kwa3gfj
          logExpireDay: 30
    

    If audit_all is false

    import * as pulumi from "@pulumi/pulumi";
    import * as tencentcloud from "@pulumi/tencentcloud";
    
    const example = new tencentcloud.MysqlAuditService("example", {
        auditAll: false,
        highLogExpireDay: 7,
        instanceId: "cdb-3kwa3gfj",
        logExpireDay: 30,
        ruleTemplateIds: ["cdb-art-3a9ww0oj"],
    });
    
    import pulumi
    import pulumi_tencentcloud as tencentcloud
    
    example = tencentcloud.MysqlAuditService("example",
        audit_all=False,
        high_log_expire_day=7,
        instance_id="cdb-3kwa3gfj",
        log_expire_day=30,
        rule_template_ids=["cdb-art-3a9ww0oj"])
    
    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.NewMysqlAuditService(ctx, "example", &tencentcloud.MysqlAuditServiceArgs{
    			AuditAll:         pulumi.Bool(false),
    			HighLogExpireDay: pulumi.Float64(7),
    			InstanceId:       pulumi.String("cdb-3kwa3gfj"),
    			LogExpireDay:     pulumi.Float64(30),
    			RuleTemplateIds: pulumi.StringArray{
    				pulumi.String("cdb-art-3a9ww0oj"),
    			},
    		})
    		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.MysqlAuditService("example", new()
        {
            AuditAll = false,
            HighLogExpireDay = 7,
            InstanceId = "cdb-3kwa3gfj",
            LogExpireDay = 30,
            RuleTemplateIds = new[]
            {
                "cdb-art-3a9ww0oj",
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.tencentcloud.MysqlAuditService;
    import com.pulumi.tencentcloud.MysqlAuditServiceArgs;
    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 MysqlAuditService("example", MysqlAuditServiceArgs.builder()
                .auditAll(false)
                .highLogExpireDay(7)
                .instanceId("cdb-3kwa3gfj")
                .logExpireDay(30)
                .ruleTemplateIds("cdb-art-3a9ww0oj")
                .build());
    
        }
    }
    
    resources:
      example:
        type: tencentcloud:MysqlAuditService
        properties:
          auditAll: false
          highLogExpireDay: 7
          instanceId: cdb-3kwa3gfj
          logExpireDay: 30
          ruleTemplateIds:
            - cdb-art-3a9ww0oj
    

    Create MysqlAuditService Resource

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

    Constructor syntax

    new MysqlAuditService(name: string, args: MysqlAuditServiceArgs, opts?: CustomResourceOptions);
    @overload
    def MysqlAuditService(resource_name: str,
                          args: MysqlAuditServiceArgs,
                          opts: Optional[ResourceOptions] = None)
    
    @overload
    def MysqlAuditService(resource_name: str,
                          opts: Optional[ResourceOptions] = None,
                          instance_id: Optional[str] = None,
                          log_expire_day: Optional[float] = None,
                          audit_all: Optional[bool] = None,
                          high_log_expire_day: Optional[float] = None,
                          mysql_audit_service_id: Optional[str] = None,
                          rule_template_ids: Optional[Sequence[str]] = None)
    func NewMysqlAuditService(ctx *Context, name string, args MysqlAuditServiceArgs, opts ...ResourceOption) (*MysqlAuditService, error)
    public MysqlAuditService(string name, MysqlAuditServiceArgs args, CustomResourceOptions? opts = null)
    public MysqlAuditService(String name, MysqlAuditServiceArgs args)
    public MysqlAuditService(String name, MysqlAuditServiceArgs args, CustomResourceOptions options)
    
    type: tencentcloud:MysqlAuditService
    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 MysqlAuditServiceArgs
    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 MysqlAuditServiceArgs
    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 MysqlAuditServiceArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args MysqlAuditServiceArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args MysqlAuditServiceArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

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

    InstanceId string
    TencentDB for MySQL instance ID.
    LogExpireDay double
    Retention period of the audit log. Valid values: 7 (one week), 30 (one month), 90 (three months), 180 (six months), 365 (one year), 1095 (three years), 1825 (five years).
    AuditAll bool
    Audit type. Valid values: true: Record all; false: Record by rules (default value).
    HighLogExpireDay double
    Retention period of high-frequency audit logs. Valid values: 7 (one week), 30 (one month).
    MysqlAuditServiceId string
    ID of the resource.
    RuleTemplateIds List<string>
    Rule template ID. If both this parameter and AuditRuleFilters are not specified, all SQL statements will be recorded.
    InstanceId string
    TencentDB for MySQL instance ID.
    LogExpireDay float64
    Retention period of the audit log. Valid values: 7 (one week), 30 (one month), 90 (three months), 180 (six months), 365 (one year), 1095 (three years), 1825 (five years).
    AuditAll bool
    Audit type. Valid values: true: Record all; false: Record by rules (default value).
    HighLogExpireDay float64
    Retention period of high-frequency audit logs. Valid values: 7 (one week), 30 (one month).
    MysqlAuditServiceId string
    ID of the resource.
    RuleTemplateIds []string
    Rule template ID. If both this parameter and AuditRuleFilters are not specified, all SQL statements will be recorded.
    instanceId String
    TencentDB for MySQL instance ID.
    logExpireDay Double
    Retention period of the audit log. Valid values: 7 (one week), 30 (one month), 90 (three months), 180 (six months), 365 (one year), 1095 (three years), 1825 (five years).
    auditAll Boolean
    Audit type. Valid values: true: Record all; false: Record by rules (default value).
    highLogExpireDay Double
    Retention period of high-frequency audit logs. Valid values: 7 (one week), 30 (one month).
    mysqlAuditServiceId String
    ID of the resource.
    ruleTemplateIds List<String>
    Rule template ID. If both this parameter and AuditRuleFilters are not specified, all SQL statements will be recorded.
    instanceId string
    TencentDB for MySQL instance ID.
    logExpireDay number
    Retention period of the audit log. Valid values: 7 (one week), 30 (one month), 90 (three months), 180 (six months), 365 (one year), 1095 (three years), 1825 (five years).
    auditAll boolean
    Audit type. Valid values: true: Record all; false: Record by rules (default value).
    highLogExpireDay number
    Retention period of high-frequency audit logs. Valid values: 7 (one week), 30 (one month).
    mysqlAuditServiceId string
    ID of the resource.
    ruleTemplateIds string[]
    Rule template ID. If both this parameter and AuditRuleFilters are not specified, all SQL statements will be recorded.
    instance_id str
    TencentDB for MySQL instance ID.
    log_expire_day float
    Retention period of the audit log. Valid values: 7 (one week), 30 (one month), 90 (three months), 180 (six months), 365 (one year), 1095 (three years), 1825 (five years).
    audit_all bool
    Audit type. Valid values: true: Record all; false: Record by rules (default value).
    high_log_expire_day float
    Retention period of high-frequency audit logs. Valid values: 7 (one week), 30 (one month).
    mysql_audit_service_id str
    ID of the resource.
    rule_template_ids Sequence[str]
    Rule template ID. If both this parameter and AuditRuleFilters are not specified, all SQL statements will be recorded.
    instanceId String
    TencentDB for MySQL instance ID.
    logExpireDay Number
    Retention period of the audit log. Valid values: 7 (one week), 30 (one month), 90 (three months), 180 (six months), 365 (one year), 1095 (three years), 1825 (five years).
    auditAll Boolean
    Audit type. Valid values: true: Record all; false: Record by rules (default value).
    highLogExpireDay Number
    Retention period of high-frequency audit logs. Valid values: 7 (one week), 30 (one month).
    mysqlAuditServiceId String
    ID of the resource.
    ruleTemplateIds List<String>
    Rule template ID. If both this parameter and AuditRuleFilters are not specified, all SQL statements will be recorded.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the MysqlAuditService 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 MysqlAuditService Resource

    Get an existing MysqlAuditService 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?: MysqlAuditServiceState, opts?: CustomResourceOptions): MysqlAuditService
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            audit_all: Optional[bool] = None,
            high_log_expire_day: Optional[float] = None,
            instance_id: Optional[str] = None,
            log_expire_day: Optional[float] = None,
            mysql_audit_service_id: Optional[str] = None,
            rule_template_ids: Optional[Sequence[str]] = None) -> MysqlAuditService
    func GetMysqlAuditService(ctx *Context, name string, id IDInput, state *MysqlAuditServiceState, opts ...ResourceOption) (*MysqlAuditService, error)
    public static MysqlAuditService Get(string name, Input<string> id, MysqlAuditServiceState? state, CustomResourceOptions? opts = null)
    public static MysqlAuditService get(String name, Output<String> id, MysqlAuditServiceState state, CustomResourceOptions options)
    resources:  _:    type: tencentcloud:MysqlAuditService    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.
    The following state arguments are supported:
    AuditAll bool
    Audit type. Valid values: true: Record all; false: Record by rules (default value).
    HighLogExpireDay double
    Retention period of high-frequency audit logs. Valid values: 7 (one week), 30 (one month).
    InstanceId string
    TencentDB for MySQL instance ID.
    LogExpireDay double
    Retention period of the audit log. Valid values: 7 (one week), 30 (one month), 90 (three months), 180 (six months), 365 (one year), 1095 (three years), 1825 (five years).
    MysqlAuditServiceId string
    ID of the resource.
    RuleTemplateIds List<string>
    Rule template ID. If both this parameter and AuditRuleFilters are not specified, all SQL statements will be recorded.
    AuditAll bool
    Audit type. Valid values: true: Record all; false: Record by rules (default value).
    HighLogExpireDay float64
    Retention period of high-frequency audit logs. Valid values: 7 (one week), 30 (one month).
    InstanceId string
    TencentDB for MySQL instance ID.
    LogExpireDay float64
    Retention period of the audit log. Valid values: 7 (one week), 30 (one month), 90 (three months), 180 (six months), 365 (one year), 1095 (three years), 1825 (five years).
    MysqlAuditServiceId string
    ID of the resource.
    RuleTemplateIds []string
    Rule template ID. If both this parameter and AuditRuleFilters are not specified, all SQL statements will be recorded.
    auditAll Boolean
    Audit type. Valid values: true: Record all; false: Record by rules (default value).
    highLogExpireDay Double
    Retention period of high-frequency audit logs. Valid values: 7 (one week), 30 (one month).
    instanceId String
    TencentDB for MySQL instance ID.
    logExpireDay Double
    Retention period of the audit log. Valid values: 7 (one week), 30 (one month), 90 (three months), 180 (six months), 365 (one year), 1095 (three years), 1825 (five years).
    mysqlAuditServiceId String
    ID of the resource.
    ruleTemplateIds List<String>
    Rule template ID. If both this parameter and AuditRuleFilters are not specified, all SQL statements will be recorded.
    auditAll boolean
    Audit type. Valid values: true: Record all; false: Record by rules (default value).
    highLogExpireDay number
    Retention period of high-frequency audit logs. Valid values: 7 (one week), 30 (one month).
    instanceId string
    TencentDB for MySQL instance ID.
    logExpireDay number
    Retention period of the audit log. Valid values: 7 (one week), 30 (one month), 90 (three months), 180 (six months), 365 (one year), 1095 (three years), 1825 (five years).
    mysqlAuditServiceId string
    ID of the resource.
    ruleTemplateIds string[]
    Rule template ID. If both this parameter and AuditRuleFilters are not specified, all SQL statements will be recorded.
    audit_all bool
    Audit type. Valid values: true: Record all; false: Record by rules (default value).
    high_log_expire_day float
    Retention period of high-frequency audit logs. Valid values: 7 (one week), 30 (one month).
    instance_id str
    TencentDB for MySQL instance ID.
    log_expire_day float
    Retention period of the audit log. Valid values: 7 (one week), 30 (one month), 90 (three months), 180 (six months), 365 (one year), 1095 (three years), 1825 (five years).
    mysql_audit_service_id str
    ID of the resource.
    rule_template_ids Sequence[str]
    Rule template ID. If both this parameter and AuditRuleFilters are not specified, all SQL statements will be recorded.
    auditAll Boolean
    Audit type. Valid values: true: Record all; false: Record by rules (default value).
    highLogExpireDay Number
    Retention period of high-frequency audit logs. Valid values: 7 (one week), 30 (one month).
    instanceId String
    TencentDB for MySQL instance ID.
    logExpireDay Number
    Retention period of the audit log. Valid values: 7 (one week), 30 (one month), 90 (three months), 180 (six months), 365 (one year), 1095 (three years), 1825 (five years).
    mysqlAuditServiceId String
    ID of the resource.
    ruleTemplateIds List<String>
    Rule template ID. If both this parameter and AuditRuleFilters are not specified, all SQL statements will be recorded.

    Import

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

    $ pulumi import tencentcloud:index/mysqlAuditService:MysqlAuditService example cdb-3kwa3gfj
    

    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.
    tencentcloud logo
    tencentcloud 1.82.29 published on Friday, Oct 10, 2025 by tencentcloudstack
      AI Agentic Workflows: Register now