@@ -96,6 +96,7 @@ func ResourceTencentCloudPrivateDnsZone() *schema.Resource {
9696 "account_vpc_set" : {
9797 Type : schema .TypeList ,
9898 Optional : true ,
99+ Computed : true ,
99100 Description : "List of authorized accounts' VPCs to associate with the private domain." ,
100101 Elem : & schema.Resource {
101102 Schema : map [string ]* schema.Schema {
@@ -288,8 +289,8 @@ func resourceTencentCloudDPrivateDnsZoneRead(d *schema.ResourceData, meta interf
288289 }
289290
290291 if response .Response .PrivateZone == nil {
291- d .SetId ("" )
292292 log .Printf ("[WARN]%s resource `tencentcloud_private_dns_zone` [%s] not found, please check if it has been deleted.\n " , logId , zoneId )
293+ d .SetId ("" )
293294 return nil
294295 }
295296
@@ -298,26 +299,30 @@ func resourceTencentCloudDPrivateDnsZoneRead(d *schema.ResourceData, meta interf
298299 _ = d .Set ("domain" , info .Domain )
299300 }
300301
301- tagSets := make ([]map [string ]interface {}, 0 , len (info .Tags ))
302- for _ , item := range info .Tags {
303- tagSets = append (tagSets , map [string ]interface {}{
304- "tag_key" : item .TagKey ,
305- "tag_value" : item .TagValue ,
306- })
302+ if info .Tags != nil {
303+ tagSets := make ([]map [string ]interface {}, 0 , len (info .Tags ))
304+ for _ , item := range info .Tags {
305+ tagSets = append (tagSets , map [string ]interface {}{
306+ "tag_key" : item .TagKey ,
307+ "tag_value" : item .TagValue ,
308+ })
309+ }
310+
311+ _ = d .Set ("tag_set" , tagSets )
307312 }
308313
309- _ = d .Set ("tag_set" , tagSets )
314+ if info .VpcSet != nil {
315+ vpcSet := make ([]map [string ]interface {}, 0 , len (info .VpcSet ))
316+ for _ , item := range info .VpcSet {
317+ vpcSet = append (vpcSet , map [string ]interface {}{
318+ "uniq_vpc_id" : item .UniqVpcId ,
319+ "region" : item .Region ,
320+ })
321+ }
310322
311- vpcSet := make ([]map [string ]interface {}, 0 , len (info .VpcSet ))
312- for _ , item := range info .VpcSet {
313- vpcSet = append (vpcSet , map [string ]interface {}{
314- "uniq_vpc_id" : item .UniqVpcId ,
315- "region" : item .Region ,
316- })
323+ _ = d .Set ("vpc_set" , vpcSet )
317324 }
318325
319- _ = d .Set ("vpc_set" , vpcSet )
320-
321326 if info .Remark != nil {
322327 _ = d .Set ("remark" , info .Remark )
323328 }
@@ -330,16 +335,18 @@ func resourceTencentCloudDPrivateDnsZoneRead(d *schema.ResourceData, meta interf
330335 _ = d .Set ("cname_speedup_status" , info .CnameSpeedupStatus )
331336 }
332337
333- accountVpcSet := make ([]map [string ]interface {}, 0 , len (info .AccountVpcSet ))
334- for _ , item := range info .AccountVpcSet {
335- accountVpcSet = append (accountVpcSet , map [string ]interface {}{
336- "uin" : item .Uin ,
337- "uniq_vpc_id" : item .UniqVpcId ,
338- "region" : item .Region ,
339- })
340- }
338+ if info .AccountVpcSet != nil {
339+ accountVpcSet := make ([]map [string ]interface {}, 0 , len (info .AccountVpcSet ))
340+ for _ , item := range info .AccountVpcSet {
341+ accountVpcSet = append (accountVpcSet , map [string ]interface {}{
342+ "uin" : item .Uin ,
343+ "uniq_vpc_id" : item .UniqVpcId ,
344+ "region" : item .Region ,
345+ })
346+ }
341347
342- _ = d .Set ("account_vpc_set" , accountVpcSet )
348+ _ = d .Set ("account_vpc_set" , accountVpcSet )
349+ }
343350
344351 client := meta .(tccommon.ProviderMeta ).GetAPIV3Conn ()
345352 tagService := svctag .NewTagService (client )
0 commit comments