@@ -58,7 +58,10 @@ func resourceAciL3ExtSubnet() *schema.Resource {
5858 Required : true ,
5959 ForceNew : true ,
6060 },
61-
61+ "name" : & schema.Schema {
62+ Type : schema .TypeString ,
63+ Optional : true ,
64+ },
6265 "aggregate" : & schema.Schema {
6366 Type : schema .TypeString ,
6467 Optional : true ,
@@ -193,6 +196,7 @@ func setL3ExtSubnetAttributes(l3extSubnet *models.L3ExtSubnet, d *schema.Resourc
193196
194197 d .Set ("external_network_instance_profile_dn" , GetParentDn (dn , fmt .Sprintf ("/extsubnet-[%s]" , l3extSubnetMap ["ip" ])))
195198 d .Set ("ip" , l3extSubnetMap ["ip" ])
199+ d .Set ("name" , l3extSubnetMap ["name" ])
196200
197201 if l3extSubnetMap ["aggregate" ] == "" {
198202 d .Set ("aggregate" , "none" )
@@ -201,7 +205,6 @@ func setL3ExtSubnetAttributes(l3extSubnet *models.L3ExtSubnet, d *schema.Resourc
201205 }
202206
203207 d .Set ("annotation" , l3extSubnetMap ["annotation" ])
204- d .Set ("ip" , l3extSubnetMap ["ip" ])
205208 d .Set ("name_alias" , l3extSubnetMap ["nameAlias" ])
206209
207210 scpGet := make ([]string , 0 , 1 )
@@ -299,6 +302,7 @@ func resourceAciL3ExtSubnetCreate(ctx context.Context, d *schema.ResourceData, m
299302 desc := d .Get ("description" ).(string )
300303
301304 ip := d .Get ("ip" ).(string )
305+ name := d .Get ("name" ).(string )
302306
303307 ExternalNetworkInstanceProfileDn := d .Get ("external_network_instance_profile_dn" ).(string )
304308
@@ -318,6 +322,7 @@ func resourceAciL3ExtSubnetCreate(ctx context.Context, d *schema.ResourceData, m
318322 if Ip , ok := d .GetOk ("ip" ); ok {
319323 l3extSubnetAttr .Ip = Ip .(string )
320324 }
325+ l3extSubnetAttr .Name = name
321326 if NameAlias , ok := d .GetOk ("name_alias" ); ok {
322327 l3extSubnetAttr .NameAlias = NameAlias .(string )
323328 }
@@ -329,7 +334,7 @@ func resourceAciL3ExtSubnetCreate(ctx context.Context, d *schema.ResourceData, m
329334 scp := strings .Join (scpList , "," )
330335 l3extSubnetAttr .Scope = scp
331336 }
332- l3extSubnet := models .NewL3ExtSubnet (fmt .Sprintf ("extsubnet-[%s]" , ip ), ExternalNetworkInstanceProfileDn , desc , l3extSubnetAttr )
337+ l3extSubnet := models .NewL3ExtSubnet (fmt .Sprintf ("extsubnet-[%s]" , ip ), ExternalNetworkInstanceProfileDn , desc , name , l3extSubnetAttr )
333338
334339 err := aciClient .Save (l3extSubnet )
335340 if err != nil {
@@ -384,6 +389,7 @@ func resourceAciL3ExtSubnetUpdate(ctx context.Context, d *schema.ResourceData, m
384389 desc := d .Get ("description" ).(string )
385390
386391 ip := d .Get ("ip" ).(string )
392+ name := d .Get ("name" ).(string )
387393
388394 ExternalNetworkInstanceProfileDn := d .Get ("external_network_instance_profile_dn" ).(string )
389395
@@ -406,6 +412,7 @@ func resourceAciL3ExtSubnetUpdate(ctx context.Context, d *schema.ResourceData, m
406412 if NameAlias , ok := d .GetOk ("name_alias" ); ok {
407413 l3extSubnetAttr .NameAlias = NameAlias .(string )
408414 }
415+ l3extSubnetAttr .Name = name
409416 if Scope , ok := d .GetOk ("scope" ); ok {
410417 scpList := make ([]string , 0 , 1 )
411418 for _ , val := range Scope .([]interface {}) {
@@ -414,7 +421,7 @@ func resourceAciL3ExtSubnetUpdate(ctx context.Context, d *schema.ResourceData, m
414421 scp := strings .Join (scpList , "," )
415422 l3extSubnetAttr .Scope = scp
416423 }
417- l3extSubnet := models .NewL3ExtSubnet (fmt .Sprintf ("extsubnet-[%s]" , ip ), ExternalNetworkInstanceProfileDn , desc , l3extSubnetAttr )
424+ l3extSubnet := models .NewL3ExtSubnet (fmt .Sprintf ("extsubnet-[%s]" , ip ), ExternalNetworkInstanceProfileDn , desc , name , l3extSubnetAttr )
418425
419426 l3extSubnet .Status = "modified"
420427
0 commit comments