Skip to content

Commit e6aa0fc

Browse files
committed
[ignore] Update the tenant_policies_endpoint_mac_tag_policy resource example and add resource comments
1 parent 4b20cc4 commit e6aa0fc

3 files changed

Lines changed: 6 additions & 2 deletions

File tree

examples/tenant_policies_endpoint_mac_tag_policy/main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ resource "mso_schema_template_vrf" "tf_vrf" {
3131
name = "tf_vrf"
3232
display_name = "tf_vrf"
3333
schema_id = mso_schema.tf_schema.id
34-
template = "tf_template"
34+
template = one(mso_schema.tf_schema.template).name
3535
}
3636

3737
resource "mso_schema_template_bd" "tf_bd" {
3838
schema_id = mso_schema.tf_schema.id
39-
template_name = "tf_template"
39+
template_name = one(mso_schema.tf_schema.template).name
4040
name = "tf_bd"
4141
display_name = "tf_bd"
4242
layer2_unknown_unicast = "proxy"

mso/datasource_mso_tenant_policies_endpoint_mac_tag_policy.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ func dataSourceMSOEndpointMACTagPolicyRead(d *schema.ResourceData, m interface{}
8484
bdUUID := d.Get("bd_uuid").(string)
8585
vrfUUID := d.Get("vrf_uuid").(string)
8686

87+
// Either 'bd_uuid' or 'vrf_uuid' must be specified to format the data source ID.
8788
if bdUUID == "" && vrfUUID == "" {
8889
return fmt.Errorf("Either 'bd_uuid' or 'vrf_uuid' must be specified to use Endpoint MAC Tag Policy Data Source")
8990
}

mso/resource_mso_tenant_policies_endpoint_mac_tag_policy.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ func resourceMSOEndpointMACTagPolicyCreate(d *schema.ResourceData, m interface{}
195195

196196
templateId := d.Get("template_id").(string)
197197

198+
// Ignoring the input validation since the API returns a clear error when bd_uuid and vrf_uuid are not provided.
198199
bdUUID := d.Get("bd_uuid").(string)
199200
vrfUUID := d.Get("vrf_uuid").(string)
200201

@@ -296,6 +297,7 @@ func resourceMSOEndpointMACTagPolicyUpdate(d *schema.ResourceData, m interface{}
296297

297298
if d.HasChange("bd_uuid") {
298299
if bdUUID, ok := d.GetOk("bd_uuid"); ok && bdUUID.(string) != "" {
300+
// Remove vrfRef if bd_uuid is being set, since both cannot coexist and NDO does not remove it automatically when bdRef is added
299301
err := addPatchPayloadToContainer(payloadCont, "remove", fmt.Sprintf("%s/vrfRef", updatePath), nil)
300302
if err != nil {
301303
return err
@@ -311,6 +313,7 @@ func resourceMSOEndpointMACTagPolicyUpdate(d *schema.ResourceData, m interface{}
311313

312314
if d.HasChange("vrf_uuid") {
313315
if vrfUUID, ok := d.GetOk("vrf_uuid"); ok && vrfUUID.(string) != "" {
316+
// Remove bdRef if vrf_uuid is being set, since both cannot coexist and NDO does not remove it automatically when vrfRef is added
314317
err := addPatchPayloadToContainer(payloadCont, "remove", fmt.Sprintf("%s/bdRef", updatePath), nil)
315318
if err != nil {
316319
return err

0 commit comments

Comments
 (0)