@@ -35,6 +35,7 @@ import (
3535 "context"
3636 "fmt"
3737 "log"
38+ "strings"
3839
3940 "github.com/hashicorp/terraform-plugin-sdk/helper/schema"
4041 "github.com/terraform-providers/terraform-provider-tencentcloud/tencentcloud/internal/helper"
@@ -131,7 +132,6 @@ func resourceTencentCloudVpcACLCreate(d *schema.ResourceData, meta interface{})
131132 if err != nil {
132133 return err
133134 }
134-
135135 return resourceTencentCloudVpcACLRead (d , meta )
136136}
137137
@@ -164,26 +164,32 @@ func resourceTencentCloudVpcACLRead(d *schema.ResourceData, meta interface{}) er
164164 _ = d .Set ("vpc_id" , info .VpcId )
165165 _ = d .Set ("create_time" , info .CreatedTime )
166166 _ = d .Set ("name" , info .NetworkAclName )
167- egressList := make ([]map [ string ] interface {} , 0 , len (info .EgressEntries ))
167+ egressList := make ([]string , 0 , len (info .EgressEntries ))
168168 for i := range info .EgressEntries {
169- result := map [string ]interface {}{
170- "protocol" : info .EgressEntries [i ].Protocol ,
171- "port" : info .EgressEntries [i ].Port ,
172- "cidr_ip" : info .EgressEntries [i ].CidrBlock ,
173- "policy" : info .EgressEntries [i ].Action ,
169+ if info .EgressEntries [i ].Port == nil || * info .EgressEntries [i ].Port == "" {
170+ continue
174171 }
175- egressList = append (egressList , result )
172+ result := strings .Join ([]string {
173+ * info .EgressEntries [i ].Action ,
174+ * info .EgressEntries [i ].CidrBlock ,
175+ * info .EgressEntries [i ].Port ,
176+ * info .EgressEntries [i ].Protocol ,
177+ }, "#" )
178+ egressList = append (egressList , strings .ToUpper (result ))
176179 }
177180
178- ingressList := make ([]map [ string ] interface {} , 0 , len (info .IngressEntries ))
181+ ingressList := make ([]string , 0 , len (info .IngressEntries ))
179182 for i := range info .IngressEntries {
180- result := map [string ]interface {}{
181- "protocol" : info .IngressEntries [i ].Protocol ,
182- "port" : info .IngressEntries [i ].Port ,
183- "cidr_ip" : info .IngressEntries [i ].CidrBlock ,
184- "policy" : info .IngressEntries [i ].Action ,
183+ if info .IngressEntries [i ].Port == nil || * info .IngressEntries [i ].Port == "" {
184+ continue
185185 }
186- ingressList = append (ingressList , result )
186+ result := strings .Join ([]string {
187+ * info .IngressEntries [i ].Action ,
188+ * info .IngressEntries [i ].CidrBlock ,
189+ * info .IngressEntries [i ].Port ,
190+ * info .IngressEntries [i ].Protocol ,
191+ }, "#" )
192+ ingressList = append (ingressList , strings .ToUpper (result ))
187193 }
188194 _ = d .Set ("egress" , egressList )
189195 _ = d .Set ("ingress" , ingressList )
0 commit comments