@@ -82,6 +82,60 @@ func ResourceTencentCloudClsTopic() *schema.Resource {
82
82
Optional : true ,
83
83
Description : "Log Topic Description." ,
84
84
},
85
+ "is_web_tracking" : {
86
+ Type : schema .TypeBool ,
87
+ Optional : true ,
88
+ Computed : true ,
89
+ 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." ,
90
+ },
91
+ "extends" : {
92
+ Type : schema .TypeList ,
93
+ Optional : true ,
94
+ MaxItems : 1 ,
95
+ Description : "Log Subject Extension Information." ,
96
+ Elem : & schema.Resource {
97
+ Schema : map [string ]* schema.Schema {
98
+ "anonymous_access" : {
99
+ Type : schema .TypeString ,
100
+ Optional : true ,
101
+ Description : "Log topic authentication free configuration information." ,
102
+ Elem : & schema.Resource {
103
+ Schema : map [string ]* schema.Schema {
104
+ "operations" : {
105
+ Type : schema .TypeList ,
106
+ Optional : true ,
107
+ Description : "Operation list, supporting trackLog (JS/HTTP upload log) and realtimeProducer (kafka protocol upload log)." ,
108
+ },
109
+ "conditions" : {
110
+ Type : schema .TypeList ,
111
+ Optional : true ,
112
+ Description : "Operation list, supporting trackLog (JS/HTTP upload log) and realtimeProducer (kafka protocol upload log)." ,
113
+ Elem : & schema.Resource {
114
+ Schema : map [string ]* schema.Schema {
115
+ "attributes" : {
116
+ Type : schema .TypeString ,
117
+ Optional : true ,
118
+ Description : "Condition attribute, currently only VpcID is supported." ,
119
+ },
120
+ "rule" : {
121
+ Type : schema .TypeInt ,
122
+ Optional : true ,
123
+ Description : "Conditional rule, 1: equal, 2: not equal." ,
124
+ },
125
+ "condition_value" : {
126
+ Type : schema .TypeString ,
127
+ Optional : true ,
128
+ Description : "The value of the corresponding conditional attribute." ,
129
+ },
130
+ },
131
+ },
132
+ },
133
+ },
134
+ },
135
+ },
136
+ },
137
+ },
138
+ },
85
139
},
86
140
}
87
141
}
@@ -144,6 +198,49 @@ func resourceTencentCloudClsTopicCreate(d *schema.ResourceData, meta interface{}
144
198
request .Describes = helper .String ("" )
145
199
}
146
200
201
+ if v , ok := d .GetOkExists ("is_web_tracking" ); ok {
202
+ request .IsWebTracking = helper .Bool (v .(bool ))
203
+ }
204
+
205
+ if v , ok := d .GetOk ("extends" ); ok {
206
+ topicExtendInfoList := make ([]* cls.TopicExtendInfo , 0 )
207
+ for _ , item := range v .([]interface {}) {
208
+ topicExtendInfo := cls.TopicExtendInfo {}
209
+ tmpMap := item .(map [string ]interface {})
210
+ anonymousInfo := cls.AnonymousInfo {}
211
+ if v , ok := tmpMap ["operations" ]; ok {
212
+ valuesSet := v .(* schema.Set ).List ()
213
+ anonymousInfo .Operations = helper .InterfacesStringsPoint (valuesSet )
214
+ }
215
+
216
+ if v , ok := tmpMap ["conditions" ]; ok {
217
+ conditionInfoList := make ([]* cls.ConditionInfo , 0 )
218
+ for _ , condition := range v .([]interface {}) {
219
+ conditionInfo := cls.ConditionInfo {}
220
+ conditionMap := condition .(map [string ]interface {})
221
+ if v , ok := conditionMap ["attributes" ]; ok {
222
+ conditionInfo .Attributes = helper .String (v .(string ))
223
+ }
224
+
225
+ if v , ok := conditionMap ["rule" ]; ok {
226
+ conditionInfo .Rule = helper .IntUint64 (v .(int ))
227
+ }
228
+
229
+ if v , ok := conditionMap ["condition_value" ]; ok {
230
+ conditionInfo .ConditionValue = helper .String (v .(string ))
231
+ }
232
+ }
233
+
234
+ anonymousInfo .Conditions = conditionInfoList
235
+ }
236
+
237
+ topicExtendInfo .AnonymousAccess = & anonymousInfo
238
+ topicExtendInfoList = append (topicExtendInfoList , & topicExtendInfo )
239
+ }
240
+
241
+ request .Extends = topicExtendInfoList [0 ]
242
+ }
243
+
147
244
err := resource .Retry (tccommon .WriteRetryTimeout , func () * resource.RetryError {
148
245
result , e := meta .(tccommon.ProviderMeta ).GetAPIV3Conn ().UseClsClient ().CreateTopic (request )
149
246
if e != nil {
@@ -209,6 +306,7 @@ func resourceTencentCloudClsTopicRead(d *schema.ResourceData, meta interface{})
209
306
_ = d .Set ("period" , topic .Period )
210
307
_ = d .Set ("hot_period" , topic .HotPeriod )
211
308
_ = d .Set ("describes" , topic .Describes )
309
+ _ = d .Set ("is_web_tracking" , topic .IsWebTracking )
212
310
213
311
return nil
214
312
}
0 commit comments