@@ -33,31 +33,30 @@ func resourceTencentCloudClbLogSet() *schema.Resource {
3333 Create : resourceTencentCloudClbLogSetCreate ,
3434 Read : resourceTencentCloudClbLogSetRead ,
3535 Delete : resourceTencentCloudClbLogSetDelete ,
36- Update : resourceTencentCloudClbLogSetUpdate ,
36+ // Update: resourceTencentCloudClbLogSetUpdate,
3737 Importer : & schema.ResourceImporter {
3838 State : schema .ImportStatePassthrough ,
3939 },
4040 Schema : map [string ]* schema.Schema {
41- "name" : {
42- Type : schema .TypeString ,
43- Optional : true ,
44- Default : "clb_logset" ,
45- Description : "Logset name, which must be unique among all CLS logsets. Default is `clb_logset`." ,
46- },
4741 "period" : {
48- Type : schema .TypeInt ,
49- Optional : true ,
50- ForceNew : true ,
42+ Type : schema .TypeInt ,
43+ Optional : true ,
44+ ForceNew : true ,
5145 Description : "Logset retention period in days. Maximun value is `90`." ,
5246 },
47+ "name" : {
48+ Type : schema .TypeString ,
49+ Computed : true ,
50+ Description : "Logset name, which unique and fixed `clb_logset` among all CLS logsets." ,
51+ },
5352 "create_time" : {
54- Type : schema .TypeString ,
55- Computed : true ,
53+ Type : schema .TypeString ,
54+ Computed : true ,
5655 Description : "Logset creation time." ,
5756 },
5857 "topic_count" : {
59- Type : schema .TypeString ,
60- Computed : true ,
58+ Type : schema .TypeString ,
59+ Computed : true ,
6160 Description : "Number of log topics in logset." ,
6261 },
6362 },
@@ -70,7 +69,7 @@ func resourceTencentCloudClbLogSetRead(d *schema.ResourceData, meta interface{})
7069
7170 logId := getLogId (contextNil )
7271 ctx := context .WithValue (context .TODO (), logIdKey , logId )
73- service := ClsService { client : meta .(* TencentCloudClient ).apiV3Conn }
72+ service := ClsService {client : meta .(* TencentCloudClient ).apiV3Conn }
7473
7574 id := d .Id ()
7675
@@ -86,6 +85,11 @@ func resourceTencentCloudClbLogSetRead(d *schema.ResourceData, meta interface{})
8685 }
8786
8887 _ = d .Set ("name" , info .LogsetName )
88+
89+ //
90+ //if _, ok := d.GetOk("period"); !ok {
91+ // _ = d.Set("period", info)
92+ //}
8993 _ = d .Set ("create_time" , info .CreateTime )
9094 _ = d .Set ("topic_count" , info .TopicCount )
9195
@@ -102,12 +106,11 @@ func resourceTencentCloudClbLogSetCreate(d *schema.ResourceData, meta interface{
102106 service := ClbService {client : meta .(* TencentCloudClient ).apiV3Conn }
103107
104108 var (
105- name = d .Get ("name" ).(string )
106109 period = d .Get ("period" ).(int )
107110 )
108111
109- // We're not support health logs for now
110- id , err := service .CreateClbLogSet (ctx , name , "" , period )
112+ // We're not support specify name and health logs for now
113+ id , err := service .CreateClbLogSet (ctx , "clb_logset" , "" , period )
111114
112115 if err != nil {
113116 return err
@@ -118,11 +121,12 @@ func resourceTencentCloudClbLogSetCreate(d *schema.ResourceData, meta interface{
118121 return resourceTencentCloudClbLogSetRead (d , meta )
119122}
120123
124+ // All fields are now Computed/ForceNew, means it does not support update
121125func resourceTencentCloudClbLogSetUpdate (d * schema.ResourceData , meta interface {}) error {
122126 defer logElapsed ("resource.tencentcloud_clb_logset.update" )()
123127 logId := getLogId (contextNil )
124128 ctx := context .WithValue (context .TODO (), logIdKey , logId )
125- service := ClsService { client : meta .(* TencentCloudClient ).apiV3Conn }
129+ service := ClsService {client : meta .(* TencentCloudClient ).apiV3Conn }
126130 request := cls .NewModifyLogsetRequest ()
127131
128132 request .LogsetId = helper .String (d .Id ())
@@ -137,7 +141,7 @@ func resourceTencentCloudClbLogSetUpdate(d *schema.ResourceData, meta interface{
137141 return err
138142 }
139143
140- return resourceTencentcloudEKSClusterRead (d , meta )
144+ return resourceTencentCloudClbLogSetCreate (d , meta )
141145}
142146
143147func resourceTencentCloudClbLogSetDelete (d * schema.ResourceData , meta interface {}) error {
@@ -148,10 +152,9 @@ func resourceTencentCloudClbLogSetDelete(d *schema.ResourceData, meta interface{
148152
149153 logId := getLogId (contextNil )
150154 ctx := context .WithValue (context .TODO (), logIdKey , logId )
151- service := ClsService { client : meta .(* TencentCloudClient ).apiV3Conn }
155+ service := ClsService {client : meta .(* TencentCloudClient ).apiV3Conn }
152156 id := d .Id ()
153157
154-
155158 if err := service .DeleteClsLogSet (ctx , id ); err != nil {
156159 return err
157160 }
0 commit comments