Skip to content

Commit 4dff613

Browse files
rafal-slominskiiRafal Slominskikuba-mazurkiewicz
authored
vn anchor logic (#424)
* vn anchor logic * put back comments, add changelog * shorten changelog * update Changelog --------- Co-authored-by: Rafal Slominski <rsominsk@cisco.com> Co-authored-by: kuba-mazurkiewicz <kmazurki@cisco.com>
1 parent 9b65417 commit 4dff613

8 files changed

Lines changed: 236 additions & 19 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
- Fix `catalystcenter_pnp_device_claim_site` resource to correctly handle day-zero template attachment when the template does not require variables
88
- Extend detection to match specific failure reason messages in addition to the `NCDP10000` error code. This prevents false error reporting when multiple devices are temporarily unreachable. Fixes [link](https://github.com/CiscoDevNet/terraform-provider-catalystcenter/issues/414)
9-
- Fix `catalystcenter_fabric_l3_virtual_network` resource to allow in-place updates to the `anchored_site_id` attribute
9+
- Fix `catalystcenter_fabric_l3_virtual_network` resource to fully support anchored Layer 3 Virtual Networks, mirroring undocumented Catalyst Center anchor handling in Create, Update, and Delete API operations
1010

1111
## 0.5.12
1212

docs/data-sources/fabric_l3_virtual_network.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ data "catalystcenter_fabric_l3_virtual_network" "example" {
2727

2828
### Read-Only
2929

30-
- `anchored_site_id` (String) Fabric ID of the fabric site this layer 3 virtual network is to be anchored at.
30+
- `anchored_site_id` (String) Fabric ID of the fabric site this layer 3 virtual network is to be anchored at. Must be one of the `fabric_ids` entries. Changing this value (including setting or clearing it) forces resource replacement, because Catalyst Center does not allow adding, changing, or removing the anchor of an existing Layer 3 Virtual Network.
3131
- `fabric_ids` (Set of String) IDs of the fabrics this layer 3 virtual network is to be assigned to.
3232
- `id` (String) The id of the object
3333
- `merge_fabric_sites` (Boolean) When set to `true`, the `fabric_ids` declared in this resource are merged with the existing fabric associations on Catalyst Center (additive on create/update, subtractive on delete), rather than replacing the entire set. Use this in environments where multiple resources or external processes manage fabric associations for the same L3 Virtual Network.

docs/guides/changelog.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ description: |-
1515

1616
- Fix `catalystcenter_pnp_device_claim_site` resource to correctly handle day-zero template attachment when the template does not require variables
1717
- Extend detection to match specific failure reason messages in addition to the `NCDP10000` error code. This prevents false error reporting when multiple devices are temporarily unreachable. Fixes [link](https://github.com/CiscoDevNet/terraform-provider-catalystcenter/issues/414)
18-
- Fix `catalystcenter_fabric_l3_virtual_network` resource to allow in-place updates to the `anchored_site_id` attribute
18+
- Fix `catalystcenter_fabric_l3_virtual_network` resource to fully support anchored Layer 3 Virtual Networks, mirroring undocumented Catalyst Center anchor handling in Create, Update, and Delete API operations
1919

2020
## 0.5.12
2121

docs/resources/fabric_l3_virtual_network.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ resource "catalystcenter_fabric_l3_virtual_network" "example" {
2828

2929
### Optional
3030

31-
- `anchored_site_id` (String) Fabric ID of the fabric site this layer 3 virtual network is to be anchored at.
31+
- `anchored_site_id` (String) Fabric ID of the fabric site this layer 3 virtual network is to be anchored at. Must be one of the `fabric_ids` entries. Changing this value (including setting or clearing it) forces resource replacement, because Catalyst Center does not allow adding, changing, or removing the anchor of an existing Layer 3 Virtual Network.
3232
- `fabric_ids` (Set of String) IDs of the fabrics this layer 3 virtual network is to be assigned to.
3333
- `merge_fabric_sites` (Boolean) When set to `true`, the `fabric_ids` declared in this resource are merged with the existing fabric associations on Catalyst Center (additive on create/update, subtractive on delete), rather than replacing the entire set. Use this in environments where multiple resources or external processes manage fabric associations for the same L3 Virtual Network.
3434

gen/definitions/fabric_l3_virtual_network.yaml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,20 @@
11
---
2+
# NOTE: The Create, Update and Delete functions in the generated resource file
3+
# (internal/provider/resource_catalystcenter_fabric_l3_virtual_network.go) contain
4+
# hand-written logic that mirrors several undocumented Catalyst Center constraints
5+
# around Layer 3 Virtual Networks, in particular anchored VNs and the
6+
# `merge_fabric_sites` (additive) mode. Specifically:
7+
# * Anchored Create is a two-phase POST+PUT (CatC rejects POST with multiple
8+
# fabricIds when anchoredSiteId is set).
9+
# * Anchored Update splits a combined add+remove of fabricIds into two
10+
# sequential PUTs (CatC errorCode NCHS20477).
11+
# * Anchored Delete pre-shrinks fabricIds to the anchor only before DELETE
12+
# (CatC errorCode NCHS20691).
13+
# * `anchored_site_id` is marked requires_replace because CatC does not allow
14+
# adding, changing, or removing the anchor of an existing L3 VN.
15+
# * `INFRA_VN` / `DEFAULT_VN` cannot be anchored and are managed via PUT only.
16+
# If you re-run `go generate`, remove the //template:begin/end markers around
17+
# these hand-edited functions so they are preserved.
218
name: Fabric L3 Virtual Network
319
rest_endpoint: /dna/intent/api/v1/sda/layer3VirtualNetworks
420
id_from_query_path: response.0
@@ -31,8 +47,9 @@ attributes:
3147
test_value: "[catalystcenter_fabric_site.test.id]"
3248
- model_name: anchoredSiteId
3349
data_path: "0"
50+
requires_replace: true
3451
response_data_path: response.0.anchoredSiteId
35-
description: Fabric ID of the fabric site this layer 3 virtual network is to be anchored at.
52+
description: "Fabric ID of the fabric site this layer 3 virtual network is to be anchored at. Must be one of the `fabric_ids` entries. Changing this value (including setting or clearing it) forces resource replacement, because Catalyst Center does not allow adding, changing, or removing the anchor of an existing Layer 3 Virtual Network."
3653
type: String
3754
example: ""
3855
exclude_test: true

internal/provider/data_source_catalystcenter_fabric_l3_virtual_network.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ func (d *FabricL3VirtualNetworkDataSource) Schema(ctx context.Context, req datas
7272
Computed: true,
7373
},
7474
"anchored_site_id": schema.StringAttribute{
75-
MarkdownDescription: "Fabric ID of the fabric site this layer 3 virtual network is to be anchored at.",
75+
MarkdownDescription: "Fabric ID of the fabric site this layer 3 virtual network is to be anchored at. Must be one of the `fabric_ids` entries. Changing this value (including setting or clearing it) forces resource replacement, because Catalyst Center does not allow adding, changing, or removing the anchor of an existing Layer 3 Virtual Network.",
7676
Computed: true,
7777
},
7878
"merge_fabric_sites": schema.BoolAttribute{

0 commit comments

Comments
 (0)