Skip to content

Commit 59c274e

Browse files
Add anycast gateway resource and data source (#99)
* added GenerateQueryParamString templating helper function * use create_query_path instead of query_param in Create and Update function (api/) * add query_param_no_body and data_source_no_id attributes query_param_no_body: bool(required=False) # Set to true if the attribute is a query parameter and not part of the body data_source_no_id: bool(required=False) # Set to true if id in data source should be optional * add import_no_id attribute, if import does not require and ID * add anycast_gateway * update changelog
1 parent 4695e66 commit 59c274e

25 files changed

+1710
-84
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
## 0.1.10 (unreleased)
22

3+
- Add `anycast_gateway` resource and data source, this resource now only works with Catalyst Center version 2.3.7.5+ `/sda/anycastGateways`
34
- BREAKING CHANGE: Modified `fabric_site` resource to use `/dna/intent/api/v1/sda/fabricSites` API endpoint, this resource now only works with Catalyst Center version 2.3.7.5+
45
- Fix issue with mandatory attributes in `transit_peer_network` resource, [link](https://github.com/CiscoDevNet/terraform-provider-catalystcenter/issues/92)
56
- BREAKING CHANGE: Fix `ip_pool` update if more than 25 pools are registered

docs/data-sources/anycast_gateway.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "catalystcenter_anycast_gateway Data Source - terraform-provider-catalystcenter"
4+
subcategory: "SDA"
5+
description: |-
6+
This data source can read the Anycast Gateway.
7+
---
8+
9+
# catalystcenter_anycast_gateway (Data Source)
10+
11+
This data source can read the Anycast Gateway.
12+
13+
## Example Usage
14+
15+
```terraform
16+
data "catalystcenter_anycast_gateway" "example" {
17+
fabric_id = "5e6f7b3a-2b0b-4a7d-8b1c-0d4b1cd5e1b1"
18+
virtual_network_name = "SDA_VN1"
19+
ip_pool_name = "MyRes1"
20+
}
21+
```
22+
23+
<!-- schema generated by tfplugindocs -->
24+
## Schema
25+
26+
### Required
27+
28+
- `fabric_id` (String) ID of the fabric to contain this anycast gateway
29+
- `ip_pool_name` (String) Name of the IP pool associated with the anycast gateway
30+
- `virtual_network_name` (String) Name of the layer 3 virtual network associated with the anycast gateway. the virtual network must have already been added to the site before creating an anycast gateway with it
31+
32+
### Read-Only
33+
34+
- `auto_generate_vlan_name` (Boolean) This field cannot be true when vlanName is provided. the vlanName will be generated as ipPoolGroupV4Cidr-virtualNetworkName for non-critical VLANs. for critical VLANs with DATA trafficType, vlanName will be CRITICAL_VLAN. for critical VLANs with VOICE trafficType, vlanName will be VOICE_VLAN
35+
- `critical_pool` (Boolean) Enable/disable critical VLAN. if true, autoGenerateVlanName must also be true. (isCriticalPool is not applicable to INFRA_VN)
36+
- `id` (String) The id of the object
37+
- `intra_subnet_routing_enabled` (Boolean) Enable/disable Intra-Subnet Routing (not applicable to INFRA_VN)
38+
- `ip_directed_broadcast` (Boolean) Enable/disable IP-directed broadcast (not applicable to INFRA_VN)
39+
- `l2_flooding_enabled` (Boolean) Enable/disable layer 2 flooding (not applicable to INFRA_VN)
40+
- `multiple_ip_to_mac_addresses` (Boolean) Enable/disable multiple IP-to-MAC Addresses (Wireless Bridged-Network Virtual Machine; not applicable to INFRA_VN)
41+
- `pool_type` (String) The pool type of the anycast gateway (required for & applicable only to INFRA_VN)
42+
- `security_group_name` (String) Name of the associated Security Group (not applicable to INFRA_VN)
43+
- `supplicant_based_extended_node_onboarding` (Boolean) Enable/disable Supplicant-Based Extended Node Onboarding (applicable only to INFRA_VN)
44+
- `tcp_mss_adjustment` (Number) TCP maximum segment size adjustment
45+
- `traffic_type` (String) The type of traffic the anycast gateway serves
46+
- `vlan_id` (Number) ID of the VLAN of the anycast gateway. allowed VLAN range is 2-4093 except for reserved VLANs 1002-1005, 2046, and 4094. if deploying an anycast gateway on a fabric zone, this vlanId must match the vlanId of the corresponding anycast gateway on the fabric site
47+
- `vlan_name` (String) Name of the VLAN of the anycast gateway
48+
- `wireless_pool` (Boolean) Enable/disable fabric-enabled wireless (not applicable to INFRA_VN)

docs/guides/changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ description: |-
99

1010
## 0.1.10 (unreleased)
1111

12+
- Add `anycast_gateway` resource and data source, this resource now only works with Catalyst Center version 2.3.7.5+ `/sda/anycastGateways`
1213
- BREAKING CHANGE: Modified `fabric_site` resource to use `/dna/intent/api/v1/sda/fabricSites` API endpoint, this resource now only works with Catalyst Center version 2.3.7.5+
1314
- Fix issue with mandatory attributes in `transit_peer_network` resource, [link](https://github.com/CiscoDevNet/terraform-provider-catalystcenter/issues/92)
1415
- BREAKING CHANGE: Fix `ip_pool` update if more than 25 pools are registered

docs/resources/anycast_gateway.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "catalystcenter_anycast_gateway Resource - terraform-provider-catalystcenter"
4+
subcategory: "SDA"
5+
description: |-
6+
Manages Anycast Gateways
7+
---
8+
9+
# catalystcenter_anycast_gateway (Resource)
10+
11+
Manages Anycast Gateways
12+
13+
## Example Usage
14+
15+
```terraform
16+
resource "catalystcenter_anycast_gateway" "example" {
17+
fabric_id = "5e6f7b3a-2b0b-4a7d-8b1c-0d4b1cd5e1b1"
18+
virtual_network_name = "SDA_VN1"
19+
ip_pool_name = "MyRes1"
20+
tcp_mss_adjustment = 1400
21+
vlan_name = "VLAN401"
22+
vlan_id = 401
23+
traffic_type = "DATA"
24+
critical_pool = false
25+
l2_flooding_enabled = false
26+
wireless_pool = false
27+
ip_directed_broadcast = false
28+
intra_subnet_routing_enabled = false
29+
multiple_ip_to_mac_addresses = false
30+
}
31+
```
32+
33+
<!-- schema generated by tfplugindocs -->
34+
## Schema
35+
36+
### Required
37+
38+
- `critical_pool` (Boolean) Enable/disable critical VLAN. if true, autoGenerateVlanName must also be true. (isCriticalPool is not applicable to INFRA_VN)
39+
- `fabric_id` (String) ID of the fabric to contain this anycast gateway
40+
- `intra_subnet_routing_enabled` (Boolean) Enable/disable Intra-Subnet Routing (not applicable to INFRA_VN)
41+
- `ip_directed_broadcast` (Boolean) Enable/disable IP-directed broadcast (not applicable to INFRA_VN)
42+
- `ip_pool_name` (String) Name of the IP pool associated with the anycast gateway
43+
- `l2_flooding_enabled` (Boolean) Enable/disable layer 2 flooding (not applicable to INFRA_VN)
44+
- `multiple_ip_to_mac_addresses` (Boolean) Enable/disable multiple IP-to-MAC Addresses (Wireless Bridged-Network Virtual Machine; not applicable to INFRA_VN)
45+
- `traffic_type` (String) The type of traffic the anycast gateway serves
46+
- Choices: `DATA`, `VOICE`
47+
- `virtual_network_name` (String) Name of the layer 3 virtual network associated with the anycast gateway. the virtual network must have already been added to the site before creating an anycast gateway with it
48+
- `vlan_name` (String) Name of the VLAN of the anycast gateway
49+
- `wireless_pool` (Boolean) Enable/disable fabric-enabled wireless (not applicable to INFRA_VN)
50+
51+
### Optional
52+
53+
- `auto_generate_vlan_name` (Boolean) This field cannot be true when vlanName is provided. the vlanName will be generated as ipPoolGroupV4Cidr-virtualNetworkName for non-critical VLANs. for critical VLANs with DATA trafficType, vlanName will be CRITICAL_VLAN. for critical VLANs with VOICE trafficType, vlanName will be VOICE_VLAN
54+
- `pool_type` (String) The pool type of the anycast gateway (required for & applicable only to INFRA_VN)
55+
- Choices: `EXTENDED_NODE`, `FABRIC_AP`
56+
- `security_group_name` (String) Name of the associated Security Group (not applicable to INFRA_VN)
57+
- `supplicant_based_extended_node_onboarding` (Boolean) Enable/disable Supplicant-Based Extended Node Onboarding (applicable only to INFRA_VN)
58+
- `tcp_mss_adjustment` (Number) TCP maximum segment size adjustment
59+
- Range: `500`-`1440`
60+
- `vlan_id` (Number) ID of the VLAN of the anycast gateway. allowed VLAN range is 2-4093 except for reserved VLANs 1002-1005, 2046, and 4094. if deploying an anycast gateway on a fabric zone, this vlanId must match the vlanId of the corresponding anycast gateway on the fabric site
61+
62+
### Read-Only
63+
64+
- `id` (String) The id of the object
65+
66+
## Import
67+
68+
Import is supported using the following syntax:
69+
70+
```shell
71+
terraform import catalystcenter_anycast_gateway.example "<fabric_id>,<virtual_network_name>,<ip_pool_name>"
72+
```
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
data "catalystcenter_anycast_gateway" "example" {
2+
fabric_id = "5e6f7b3a-2b0b-4a7d-8b1c-0d4b1cd5e1b1"
3+
virtual_network_name = "SDA_VN1"
4+
ip_pool_name = "MyRes1"
5+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
terraform import catalystcenter_anycast_gateway.example "<fabric_id>,<virtual_network_name>,<ip_pool_name>"
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
resource "catalystcenter_anycast_gateway" "example" {
2+
fabric_id = "5e6f7b3a-2b0b-4a7d-8b1c-0d4b1cd5e1b1"
3+
virtual_network_name = "SDA_VN1"
4+
ip_pool_name = "MyRes1"
5+
tcp_mss_adjustment = 1400
6+
vlan_name = "VLAN401"
7+
vlan_id = 401
8+
traffic_type = "DATA"
9+
critical_pool = false
10+
l2_flooding_enabled = false
11+
wireless_pool = false
12+
ip_directed_broadcast = false
13+
intra_subnet_routing_enabled = false
14+
multiple_ip_to_mac_addresses = false
15+
}

gen/definitions/anycast_gateway.yaml

Lines changed: 186 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,186 @@
1+
---
2+
name: Anycast Gateway
3+
rest_endpoint: /dna/intent/api/v1/sda/anycastGateways
4+
res_description: Manages Anycast Gateways
5+
id_from_query_path: response.0
6+
id_from_query_path_attribute: id
7+
import_no_id: true
8+
data_source_no_id: true
9+
put_id_include_path: "0.id"
10+
put_no_id: true
11+
max_async_wait_time: 120
12+
doc_category: SDA
13+
attributes:
14+
- model_name: fabricId
15+
requires_replace: true
16+
data_path: '0'
17+
query_param: true
18+
response_data_path: response.0.fabricId
19+
mandatory: true
20+
description: ID of the fabric to contain this anycast gateway
21+
type: String
22+
example: 5e6f7b3a-2b0b-4a7d-8b1c-0d4b1cd5e1b1
23+
test_value: catalystcenter_fabric_site.test.id
24+
- model_name: virtualNetworkName
25+
requires_replace: true
26+
data_path: '0'
27+
query_param: true
28+
response_data_path: response.0.virtualNetworkName
29+
type: String
30+
mandatory: true
31+
description: Name of the layer 3 virtual network associated with the anycast gateway. the virtual network must have already been added to the site before creating an anycast gateway with it
32+
example: SDA_VN1
33+
test_value: catalystcenter_virtual_network_to_fabric_site.test.virtual_network_name
34+
- model_name: ipPoolName
35+
requires_replace: true
36+
query_param: true
37+
data_path: '0'
38+
response_data_path: response.0.ipPoolName
39+
type: String
40+
mandatory: true
41+
description: Name of the IP pool associated with the anycast gateway
42+
example: MyRes1
43+
test_value: catalystcenter_ip_pool_reservation.test.name
44+
- model_name: tcpMssAdjustment
45+
data_path: '0'
46+
response_data_path: response.0.tcpMssAdjustment
47+
type: Int64
48+
min_int: 500
49+
max_int: 1440
50+
description: TCP maximum segment size adjustment
51+
example: 1400
52+
- model_name: vlanName
53+
requires_replace: true
54+
data_path: '0'
55+
response_data_path: response.0.vlanName
56+
type: String
57+
description: Name of the VLAN of the anycast gateway
58+
mandatory: true
59+
example: VLAN401
60+
- model_name: vlanId
61+
requires_replace: true
62+
data_path: '0'
63+
response_data_path: response.0.vlanId
64+
type: Int64
65+
description: ID of the VLAN of the anycast gateway. allowed VLAN range is 2-4093 except for reserved VLANs 1002-1005, 2046, and 4094. if deploying an anycast gateway on a fabric zone, this vlanId must match the vlanId of the corresponding anycast gateway on the fabric site
66+
example: 401
67+
- model_name: trafficType
68+
data_path: '0'
69+
response_data_path: response.0.trafficType
70+
type: String
71+
enum_values: [DATA, VOICE]
72+
mandatory: true
73+
description: The type of traffic the anycast gateway serves
74+
example: DATA
75+
- model_name: poolType
76+
data_path: '0'
77+
response_data_path: response.0.poolType
78+
type: String
79+
enum_values: [EXTENDED_NODE, FABRIC_AP]
80+
description: The pool type of the anycast gateway (required for & applicable only to INFRA_VN)
81+
exclude_test: true
82+
- model_name: securityGroupName
83+
data_path: '0'
84+
response_data_path: response.0.securityGroupNames
85+
type: String
86+
description: Name of the associated Security Group (not applicable to INFRA_VN)
87+
exclude_test: true
88+
- model_name: isCriticalPool
89+
requires_replace: true
90+
data_path: '0'
91+
response_data_path: response.0.isCriticalPool
92+
tf_name: critical_pool
93+
type: Bool
94+
mandatory: true
95+
description: Enable/disable critical VLAN. if true, autoGenerateVlanName must also be true. (isCriticalPool is not applicable to INFRA_VN)
96+
example: false
97+
- model_name: isLayer2FloodingEnabled
98+
data_path: '0'
99+
response_data_path: response.0.isLayer2FloodingEnabled
100+
tf_name: l2_flooding_enabled
101+
type: Bool
102+
mandatory: true
103+
description: Enable/disable layer 2 flooding (not applicable to INFRA_VN)
104+
example: false
105+
- model_name: isWirelessPool
106+
data_path: '0'
107+
response_data_path: response.0.isWirelessPool
108+
tf_name: wireless_pool
109+
type: Bool
110+
mandatory: true
111+
description: Enable/disable fabric-enabled wireless (not applicable to INFRA_VN)
112+
example: false
113+
- model_name: isIpDirectedBroadcast
114+
data_path: '0'
115+
response_data_path: response.0.isIpDirectedBroadcast
116+
tf_name: ip_directed_broadcast
117+
type: Bool
118+
mandatory: true
119+
description: Enable/disable IP-directed broadcast (not applicable to INFRA_VN)
120+
example: false
121+
- model_name: isIntraSubnetRoutingEnabled
122+
requires_replace: true
123+
data_path: '0'
124+
response_data_path: response.0.isIntraSubnetRoutingEnabled
125+
tf_name: intra_subnet_routing_enabled
126+
type: Bool
127+
mandatory: true
128+
description: Enable/disable Intra-Subnet Routing (not applicable to INFRA_VN)
129+
example: false
130+
- model_name: isMultipleIpToMacAddresses
131+
data_path: '0'
132+
response_data_path: response.0.isMultipleIpToMacAddresses
133+
tf_name: multiple_ip_to_mac_addresses
134+
type: Bool
135+
mandatory: true
136+
description: Enable/disable multiple IP-to-MAC Addresses (Wireless Bridged-Network Virtual Machine; not applicable to INFRA_VN)
137+
example: false
138+
- model_name: isSupplicantBasedExtendedNodeOnboarding
139+
data_path: '0'
140+
response_data_path: response.0.isSupplicantBasedExtendedNodeOnboarding
141+
tf_name: supplicant_based_extended_node_onboarding
142+
type: Bool
143+
description: Enable/disable Supplicant-Based Extended Node Onboarding (applicable only to INFRA_VN)
144+
exclude_test: true
145+
- model_name: autoGenerateVlanName
146+
data_path: '0'
147+
response_data_path: response.0.autoGenerateVlanName
148+
type: Bool
149+
description: 'This field cannot be true when vlanName is provided. the vlanName will be generated as ipPoolGroupV4Cidr-virtualNetworkName for non-critical VLANs. for critical VLANs with DATA trafficType, vlanName will be CRITICAL_VLAN. for critical VLANs with VOICE trafficType, vlanName will be VOICE_VLAN'
150+
exclude_test: true
151+
test_prerequisites: |
152+
resource "catalystcenter_area" "test" {
153+
name = "Area1"
154+
parent_name = "Global"
155+
depends_on = [catalystcenter_ip_pool.test]
156+
}
157+
resource "catalystcenter_ip_pool" "test" {
158+
name = "MyPool1"
159+
ip_subnet = "172.32.0.0/16"
160+
}
161+
resource "catalystcenter_ip_pool_reservation" "test" {
162+
site_id = catalystcenter_area.test.id
163+
name = "MyRes1"
164+
type = "Generic"
165+
ipv4_global_pool = catalystcenter_ip_pool.test.ip_subnet
166+
ipv4_prefix = true
167+
ipv4_prefix_length = 24
168+
ipv4_subnet = "172.32.1.0"
169+
depends_on = [catalystcenter_ip_pool.test]
170+
}
171+
resource "catalystcenter_fabric_site" "test" {
172+
site_id = catalystcenter_area.test.id
173+
pub_sub_enabled = false
174+
authentication_profile_name = "No Authentication"
175+
depends_on = [catalystcenter_area.test]
176+
}
177+
resource "catalystcenter_fabric_virtual_network" "test" {
178+
virtual_network_name = "SDA_VN1"
179+
is_guest = false
180+
sg_names = ["Employees"]
181+
}
182+
resource "catalystcenter_virtual_network_to_fabric_site" "test" {
183+
virtual_network_name = "SDA_VN1"
184+
site_name_hierarchy = "Global/Area1"
185+
depends_on = [catalystcenter_fabric_virtual_network.test, catalystcenter_fabric_site.test]
186+
}

gen/definitions/assign_credentials.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ attributes:
1313
type: String
1414
query_param: true
1515
id: true
16+
create_query_path: true
1617
description: The site ID
1718
example: 5e6f7b3a-2b0b-4a7d-8b1c-0d4b1cd5e1b1
1819
test_value: catalystcenter_area.test.id

gen/definitions/image.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ attributes:
4444
mandatory: true
4545
id: true
4646
query_param: true
47+
query_param_no_body: true
4748
response_data_path: response.0.name
4849
data_path: '0'
4950
requires_replace: true

0 commit comments

Comments
 (0)