diff --git a/.changelog/2721.txt b/.changelog/2721.txt new file mode 100644 index 0000000000..e288e3b1af --- /dev/null +++ b/.changelog/2721.txt @@ -0,0 +1,3 @@ +```release-note:enhancement +resource/tencentcloud_cls_topic: add `is_web_tracking`, `extends` params +``` diff --git a/go.mod b/go.mod index ad3f33a3ed..49e1dfed1f 100644 --- a/go.mod +++ b/go.mod @@ -45,7 +45,7 @@ require ( github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ckafka v1.0.748 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/clb v1.0.860 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cloudaudit v1.0.544 - github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cls v1.0.952 + github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cls v1.0.962 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.964 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm v1.0.624 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cwp v1.0.762 diff --git a/go.sum b/go.sum index 859d1b227c..8ce902e75a 100644 --- a/go.sum +++ b/go.sum @@ -862,6 +862,8 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cls v1.0.860 h1:IU20AhN github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cls v1.0.860/go.mod h1:RP3NkBvKio1dFmCNKozHX9qmef57sUCfsTcE0FnCvjk= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cls v1.0.952 h1:+4g+Wp3WKTf/QU814lF+kft4jP/NNUkggciB/n0joTM= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cls v1.0.952/go.mod h1:OW+FNkQgeQTesREQ7iPA4g9V81cEb/NcWSYO6bYe2Qo= +github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cls v1.0.962 h1:rkceP3tcjU0BCh9xloqZ5cuzDXP327YlQgWHXEaVgns= +github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cls v1.0.962/go.mod h1:OEg00w6fKlT/3Q/4UI13P5kEJU2IvZm3XMZGUYEKPPs= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.414/go.mod h1:7sCQWVkxcsR38nffDW057DRGk8mUjK1Ing/EFOK8s8Y= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.486/go.mod h1:7sCQWVkxcsR38nffDW057DRGk8mUjK1Ing/EFOK8s8Y= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.524/go.mod h1:7sCQWVkxcsR38nffDW057DRGk8mUjK1Ing/EFOK8s8Y= @@ -950,6 +952,12 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.963 h1:lUVC github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.963/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.964 h1:ET3EulYQvWrdD5FNwOP+196w5Vbniy/uRGucM5ILExQ= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.964/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0= +github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.962 h1:H7V/7lpplT3r5zW5/W+agrsJC8MCA1/f6zWWrMZYykU= +github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.962/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0= +github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.950 h1:gsBG5scMDYykLzPSj9aXCTxVjWE5lt+y6VwNAROf7Fw= +github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.950/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0= +github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.961 h1:UqinjIsO+Y48BQYSxrD6aHQe8SD+Wsbvj+jU9V9VvWM= +github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.961/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/csip v1.0.860 h1:F3esKBIT3HW9+7Gt8cVgf8X06VdGIczpgLBUECzSEzU= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/csip v1.0.860/go.mod h1:NZo1WplQcC314kMlCRUoy8NQju2BnolIJj7NAWgsuhY= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm v1.0.624 h1:nEZqsoqt1pEoaP9JjkHQy3/H00suCfzlHW1qOm2nYD8= diff --git a/tencentcloud/services/cls/resource_tc_cls_topic.go b/tencentcloud/services/cls/resource_tc_cls_topic.go index 14d6d0a123..d831aa921c 100644 --- a/tencentcloud/services/cls/resource_tc_cls_topic.go +++ b/tencentcloud/services/cls/resource_tc_cls_topic.go @@ -18,8 +18,8 @@ func ResourceTencentCloudClsTopic() *schema.Resource { return &schema.Resource{ Create: resourceTencentCloudClsTopicCreate, Read: resourceTencentCloudClsTopicRead, - Delete: resourceTencentCloudClsTopicDelete, Update: resourceTencentCloudClsTopicUpdate, + Delete: resourceTencentCloudClsTopicDelete, Importer: &schema.ResourceImporter{ State: schema.ImportStatePassthrough, }, @@ -82,6 +82,62 @@ func ResourceTencentCloudClsTopic() *schema.Resource { Optional: true, Description: "Log Topic Description.", }, + "is_web_tracking": { + Type: schema.TypeBool, + Optional: true, + Computed: true, + Description: "No authentication switch. False: closed; True: Enable. The default is false. After activation, anonymous access to the log topic will be supported for specified operations.", + }, + "extends": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Description: "Log Subject Extension Information.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "anonymous_access": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Description: "Log topic authentication free configuration information.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "operations": { + Type: schema.TypeList, + Optional: true, + Description: "Operation list, supporting trackLog (JS/HTTP upload log) and realtimeProducer (kafka protocol upload log).", + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "conditions": { + Type: schema.TypeList, + Optional: true, + Description: "Operation list, supporting trackLog (JS/HTTP upload log) and realtimeProducer (kafka protocol upload log).", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "attributes": { + Type: schema.TypeString, + Optional: true, + Description: "Condition attribute, currently only VpcID is supported.", + }, + "rule": { + Type: schema.TypeInt, + Optional: true, + Description: "Conditional rule, 1: equal, 2: not equal.", + }, + "condition_value": { + Type: schema.TypeString, + Optional: true, + Description: "The value of the corresponding conditional attribute.", + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, }, } } @@ -90,9 +146,10 @@ func resourceTencentCloudClsTopicCreate(d *schema.ResourceData, meta interface{} defer tccommon.LogElapsed("resource.tencentcloud_cls_topic.create")() var ( - logId = tccommon.GetLogId(tccommon.ContextNil) - request = cls.NewCreateTopicRequest() - response *cls.CreateTopicResponse + logId = tccommon.GetLogId(tccommon.ContextNil) + request = cls.NewCreateTopicRequest() + response *cls.CreateTopicResponse + isWebTracking bool ) if v, ok := d.GetOk("logset_id"); ok { @@ -144,6 +201,56 @@ func resourceTencentCloudClsTopicCreate(d *schema.ResourceData, meta interface{} request.Describes = helper.String("") } + if v, ok := d.GetOkExists("is_web_tracking"); ok { + request.IsWebTracking = helper.Bool(v.(bool)) + isWebTracking = v.(bool) + } + + if isWebTracking { + if dMap, ok := helper.InterfacesHeadMap(d, "extends"); ok { + topicExtendInfo := cls.TopicExtendInfo{} + if anonymousAccessMap, ok := helper.InterfaceToMap(dMap, "anonymous_access"); ok { + anonymousInfo := cls.AnonymousInfo{} + if v, ok := anonymousAccessMap["operations"]; ok { + tmpList := make([]*string, 0) + for _, operation := range v.([]interface{}) { + tmpList = append(tmpList, helper.String(operation.(string))) + } + + anonymousInfo.Operations = tmpList + } + + if v, ok := anonymousAccessMap["conditions"]; ok { + for _, condition := range v.([]interface{}) { + conditionMap := condition.(map[string]interface{}) + conditionInfo := cls.ConditionInfo{} + if v, ok := conditionMap["attributes"]; ok { + conditionInfo.Attributes = helper.String(v.(string)) + } + + if v, ok := conditionMap["rule"]; ok { + conditionInfo.Rule = helper.IntUint64(v.(int)) + } + + if v, ok := conditionMap["condition_value"]; ok { + conditionInfo.ConditionValue = helper.String(v.(string)) + } + + anonymousInfo.Conditions = append(anonymousInfo.Conditions, &conditionInfo) + } + } + + topicExtendInfo.AnonymousAccess = &anonymousInfo + } + + request.Extends = &topicExtendInfo + } + } else { + if _, ok := helper.InterfacesHeadMap(d, "extends"); ok { + return fmt.Errorf("If `is_web_tracking` is false, Not support set `extends`.\n.") + } + } + err := resource.Retry(tccommon.WriteRetryTimeout, func() *resource.RetryError { result, e := meta.(tccommon.ProviderMeta).GetAPIV3Conn().UseClsClient().CreateTopic(request) if e != nil { @@ -209,6 +316,50 @@ func resourceTencentCloudClsTopicRead(d *schema.ResourceData, meta interface{}) _ = d.Set("period", topic.Period) _ = d.Set("hot_period", topic.HotPeriod) _ = d.Set("describes", topic.Describes) + _ = d.Set("is_web_tracking", topic.IsWebTracking) + + if *topic.IsWebTracking { + if topic.Extends != nil { + extendMap := map[string]interface{}{} + if topic.Extends.AnonymousAccess != nil { + anonymousAccessMap := map[string]interface{}{} + if topic.Extends.AnonymousAccess.Operations != nil { + operationList := make([]string, 0, len(topic.Extends.AnonymousAccess.Operations)) + for _, v := range topic.Extends.AnonymousAccess.Operations { + operationList = append(operationList, *v) + } + + anonymousAccessMap["operations"] = operationList + } + + if topic.Extends.AnonymousAccess.Conditions != nil { + conditionList := []interface{}{} + for _, v := range topic.Extends.AnonymousAccess.Conditions { + conditionMap := map[string]interface{}{} + if v.Attributes != nil { + conditionMap["attributes"] = *v.Attributes + } + + if v.Rule != nil { + conditionMap["rule"] = *v.Rule + } + + if v.ConditionValue != nil { + conditionMap["condition_value"] = *v.ConditionValue + } + + conditionList = append(conditionList, conditionMap) + } + + anonymousAccessMap["conditions"] = conditionList + } + + extendMap["anonymous_access"] = []interface{}{anonymousAccessMap} + } + + _ = d.Set("extends", []interface{}{extendMap}) + } + } return nil } @@ -217,9 +368,10 @@ func resourceTencentCloudClsTopicUpdate(d *schema.ResourceData, meta interface{} defer tccommon.LogElapsed("resource.tencentcloud_cls_topic.update")() var ( - logId = tccommon.GetLogId(tccommon.ContextNil) - request = cls.NewModifyTopicRequest() - id = d.Id() + logId = tccommon.GetLogId(tccommon.ContextNil) + request = cls.NewModifyTopicRequest() + id = d.Id() + isWebTracking bool ) immutableArgs := []string{"partition_count", "storage_type"} @@ -269,6 +421,57 @@ func resourceTencentCloudClsTopicUpdate(d *schema.ResourceData, meta interface{} request.Describes = helper.String(d.Get("describes").(string)) } + if v, ok := d.GetOkExists("is_web_tracking"); ok { + request.IsWebTracking = helper.Bool(v.(bool)) + isWebTracking = v.(bool) + } + + if isWebTracking { + if dMap, ok := helper.InterfacesHeadMap(d, "extends"); ok { + if anonymousAccessMap, ok := helper.InterfaceToMap(dMap, "anonymous_access"); ok { + topicExtendInfo := cls.TopicExtendInfo{} + anonymousInfo := cls.AnonymousInfo{} + if v, ok := anonymousAccessMap["operations"]; ok { + tmpList := make([]*string, 0) + for _, operation := range v.([]interface{}) { + tmpList = append(tmpList, helper.String(operation.(string))) + } + + anonymousInfo.Operations = tmpList + } + + if v, ok := anonymousAccessMap["conditions"]; ok { + for _, condition := range v.([]interface{}) { + conditionMap := condition.(map[string]interface{}) + conditionInfo := cls.ConditionInfo{} + if v, ok := conditionMap["attributes"]; ok { + conditionInfo.Attributes = helper.String(v.(string)) + } + + if v, ok := conditionMap["rule"]; ok { + conditionInfo.Rule = helper.IntUint64(v.(int)) + } + + if v, ok := conditionMap["condition_value"]; ok { + conditionInfo.ConditionValue = helper.String(v.(string)) + } + + anonymousInfo.Conditions = append(anonymousInfo.Conditions, &conditionInfo) + } + } + + topicExtendInfo.AnonymousAccess = &anonymousInfo + request.Extends = &topicExtendInfo + } + } else { + return fmt.Errorf("If `is_web_tracking` is true, Must set `extends` params.\n.") + } + } else { + if _, ok := helper.InterfacesHeadMap(d, "extends"); ok { + return fmt.Errorf("If `is_web_tracking` is false, Not support set `extends` params.\n.") + } + } + err := resource.Retry(tccommon.WriteRetryTimeout, func() *resource.RetryError { result, e := meta.(tccommon.ProviderMeta).GetAPIV3Conn().UseClsClient().ModifyTopic(request) if e != nil { diff --git a/tencentcloud/services/cls/resource_tc_cls_topic.md b/tencentcloud/services/cls/resource_tc_cls_topic.md index a0336b085f..d82db4ec76 100644 --- a/tencentcloud/services/cls/resource_tc_cls_topic.md +++ b/tencentcloud/services/cls/resource_tc_cls_topic.md @@ -2,11 +2,13 @@ Provides a resource to create a cls topic. Example Usage +Create a standard cls topic + ```hcl resource "tencentcloud_cls_logset" "example" { logset_name = "tf_example" - tags = { - "demo" = "test" + tags = { + tagKey = "tagValue" } } @@ -20,8 +22,47 @@ resource "tencentcloud_cls_topic" "example" { storage_type = "hot" describes = "Test Demo." hot_period = 10 - tags = { - "test" = "test", + tags = { + tagKey = "tagValue" + } +} +``` + +Create a cls topic with web tracking + +```hcl +resource "tencentcloud_cls_logset" "example" { + logset_name = "tf_example" + tags = { + tagKey = "tagValue" + } +} + +resource "tencentcloud_cls_topic" "example" { + topic_name = "tf_example" + logset_id = tencentcloud_cls_logset.example.id + auto_split = false + max_split_partitions = 20 + partition_count = 1 + period = 30 + storage_type = "hot" + describes = "Test Demo." + hot_period = 10 + is_web_tracking = true + + extends { + anonymous_access { + operations = ["trackLog", "realtimeProducer"] + conditions { + attributes = "VpcID" + rule = 1 + condition_value = "vpc-ahr3xajx" + } + } + } + + tags = { + tagKey = "tagValue" } } ``` diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cls/v20201016/models.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cls/v20201016/models.go index e03c5dc97f..7c49d7d9b4 100644 --- a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cls/v20201016/models.go +++ b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cls/v20201016/models.go @@ -6566,6 +6566,42 @@ func (r *DescribeMachineGroupsResponse) FromJsonString(s string) error { type DescribeMachinesRequestParams struct { // 查询的机器组ID GroupId *string `json:"GroupId,omitnil,omitempty" name:"GroupId"` + + // ip + // - 按照【ip】进行过滤。 + // - 类型:String + // - 必选:否 + // + // instance + // - 按照【instance】进行过滤。 + // - 类型:String + // - 必选:否 + // + // version + // - 按照【LogListener版本】进行过滤。 + // - 类型:String + // - 必选:否 + // + // status + // - 按照【状态】进行过滤。 + // - 类型:String + // - 必选:否 + // - 可选值:0:离线,1:正常 + // + // offlineTime + // - 按照【机器离线时间】进行过滤。 + // - 类型:String + // - 必选:否 + // - - 可选值:0:无离线时间,12:12小时内,24:一天内,48:两天内,99:两天前 + // + // 每次请求的Filters的上限为10,Filter.Values的上限为100。 + Filters []*Filter `json:"Filters,omitnil,omitempty" name:"Filters"` + + // 分页的偏移量。 + Offset *uint64 `json:"Offset,omitnil,omitempty" name:"Offset"` + + // 分页单页限制数目。最大支持100 + Limit *uint64 `json:"Limit,omitnil,omitempty" name:"Limit"` } type DescribeMachinesRequest struct { @@ -6573,6 +6609,42 @@ type DescribeMachinesRequest struct { // 查询的机器组ID GroupId *string `json:"GroupId,omitnil,omitempty" name:"GroupId"` + + // ip + // - 按照【ip】进行过滤。 + // - 类型:String + // - 必选:否 + // + // instance + // - 按照【instance】进行过滤。 + // - 类型:String + // - 必选:否 + // + // version + // - 按照【LogListener版本】进行过滤。 + // - 类型:String + // - 必选:否 + // + // status + // - 按照【状态】进行过滤。 + // - 类型:String + // - 必选:否 + // - 可选值:0:离线,1:正常 + // + // offlineTime + // - 按照【机器离线时间】进行过滤。 + // - 类型:String + // - 必选:否 + // - - 可选值:0:无离线时间,12:12小时内,24:一天内,48:两天内,99:两天前 + // + // 每次请求的Filters的上限为10,Filter.Values的上限为100。 + Filters []*Filter `json:"Filters,omitnil,omitempty" name:"Filters"` + + // 分页的偏移量。 + Offset *uint64 `json:"Offset,omitnil,omitempty" name:"Offset"` + + // 分页单页限制数目。最大支持100 + Limit *uint64 `json:"Limit,omitnil,omitempty" name:"Limit"` } func (r *DescribeMachinesRequest) ToJsonString() string { @@ -6588,6 +6660,9 @@ func (r *DescribeMachinesRequest) FromJsonString(s string) error { return err } delete(f, "GroupId") + delete(f, "Filters") + delete(f, "Offset") + delete(f, "Limit") if len(f) > 0 { return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribeMachinesRequest has unknown keys!", "") } @@ -6614,6 +6689,10 @@ type DescribeMachinesResponseParams struct { // 是否开启服务日志 ServiceLogging *bool `json:"ServiceLogging,omitnil,omitempty" name:"ServiceLogging"` + // 总数目 + // 注意:此字段可能返回 null,表示取不到有效值。 + TotalCount *uint64 `json:"TotalCount,omitnil,omitempty" name:"TotalCount"` + // 唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。 RequestId *string `json:"RequestId,omitnil,omitempty" name:"RequestId"` } diff --git a/vendor/modules.txt b/vendor/modules.txt index 24f0fb542e..6ec65fadc8 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1154,7 +1154,7 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/clb/v20180317 # github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cloudaudit v1.0.544 ## explicit; go 1.14 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cloudaudit/v20190319 -# github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cls v1.0.952 +# github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cls v1.0.962 ## explicit; go 1.14 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cls/v20201016 # github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.964 diff --git a/website/docs/r/cls_topic.html.markdown b/website/docs/r/cls_topic.html.markdown index 004cefaac3..610640ec1f 100644 --- a/website/docs/r/cls_topic.html.markdown +++ b/website/docs/r/cls_topic.html.markdown @@ -13,11 +13,39 @@ Provides a resource to create a cls topic. ## Example Usage +### Create a standard cls topic + +```hcl +resource "tencentcloud_cls_logset" "example" { + logset_name = "tf_example" + tags = { + tagKey = "tagValue" + } +} + +resource "tencentcloud_cls_topic" "example" { + topic_name = "tf_example" + logset_id = tencentcloud_cls_logset.example.id + auto_split = false + max_split_partitions = 20 + partition_count = 1 + period = 30 + storage_type = "hot" + describes = "Test Demo." + hot_period = 10 + tags = { + tagKey = "tagValue" + } +} +``` + +### Create a cls topic with web tracking + ```hcl resource "tencentcloud_cls_logset" "example" { logset_name = "tf_example" tags = { - "demo" = "test" + tagKey = "tagValue" } } @@ -31,8 +59,21 @@ resource "tencentcloud_cls_topic" "example" { storage_type = "hot" describes = "Test Demo." hot_period = 10 + is_web_tracking = true + + extends { + anonymous_access { + operations = ["trackLog", "realtimeProducer"] + conditions { + attributes = "VpcID" + rule = 1 + condition_value = "vpc-ahr3xajx" + } + } + } + tags = { - "test" = "test", + tagKey = "tagValue" } } ``` @@ -45,13 +86,30 @@ The following arguments are supported: * `topic_name` - (Required, String) Log topic name. * `auto_split` - (Optional, Bool) Whether to enable automatic split. Default value: true. * `describes` - (Optional, String) Log Topic Description. +* `extends` - (Optional, List) Log Subject Extension Information. * `hot_period` - (Optional, Int) 0: Turn off log sinking. Non 0: The number of days of standard storage after enabling log settling. HotPeriod needs to be greater than or equal to 7 and less than Period. Only effective when StorageType is hot. +* `is_web_tracking` - (Optional, Bool) No authentication switch. False: closed; True: Enable. The default is false. After activation, anonymous access to the log topic will be supported for specified operations. * `max_split_partitions` - (Optional, Int) Maximum number of partitions to split into for this topic if automatic split is enabled. Default value: 50. * `partition_count` - (Optional, Int) Number of log topic partitions. Default value: 1. Maximum value: 10. * `period` - (Optional, Int) Lifecycle in days. Value range: 1~366. Default value: 30. * `storage_type` - (Optional, String) Log topic storage class. Valid values: hot: real-time storage; cold: offline storage. Default value: hot. If cold is passed in, please contact the customer service to add the log topic to the allowlist first. * `tags` - (Optional, Map) Tag description list. Up to 10 tag key-value pairs are supported and must be unique. +The `anonymous_access` object of `extends` supports the following: + +* `conditions` - (Optional, List) Operation list, supporting trackLog (JS/HTTP upload log) and realtimeProducer (kafka protocol upload log). +* `operations` - (Optional, List) Operation list, supporting trackLog (JS/HTTP upload log) and realtimeProducer (kafka protocol upload log). + +The `conditions` object of `anonymous_access` supports the following: + +* `attributes` - (Optional, String) Condition attribute, currently only VpcID is supported. +* `condition_value` - (Optional, String) The value of the corresponding conditional attribute. +* `rule` - (Optional, Int) Conditional rule, 1: equal, 2: not equal. + +The `extends` object supports the following: + +* `anonymous_access` - (Optional, List) Log topic authentication free configuration information. + ## Attributes Reference In addition to all arguments above, the following attributes are exported: