Skip to content

Commit 095c4c1

Browse files
authored
Service lan_vpn_feature static route gateway configuration enhancement (#468)
1 parent 3ac9d8e commit 095c4c1

13 files changed

+118
-46
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
- Add missing options under `unsupported_features` attribute of `sdwan_configuration_group`, [link](https://github.com/CiscoDevNet/terraform-provider-sdwan/issues/478)
88
- Add `sdwan_policy_group` resource and data source
99
- Adds `enhanced_app_aware_routing` support to the `sdwan_cisco_system_feature_template` resource and data source
10+
- Add `gateway` attribute for `ipv4_static_routes` and `ipv6_static_routes` in `sdwan_service_lan_vpn_feature` resource
1011

1112
## 0.6.2
1213

docs/data-sources/service_lan_vpn_feature.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,8 @@ Read-Only:
179179

180180
Read-Only:
181181

182-
- `gateway_dhcp` (Boolean) IPv4 Route Gateway DHCP
182+
- `dhcp` (Boolean) IPv4 Route Gateway DHCP
183+
- `gateway` (String) Gateway type
183184
- `network_address` (String) IP Address
184185
- `network_address_variable` (String) Variable name
185186
- `next_hop_with_trackers` (Attributes List) IPv4 Route Gateway Next Hop with Tracker (see [below for nested schema](#nestedatt--ipv4_static_routes--next_hop_with_trackers))
@@ -236,6 +237,7 @@ Read-Only:
236237

237238
Read-Only:
238239

240+
- `gateway` (String) Gateway type
239241
- `nat` (String) IPv6 Nat
240242
- `nat_variable` (String) Variable name
241243
- `next_hops` (Attributes List) IPv6 Route Gateway Next Hop (see [below for nested schema](#nestedatt--ipv6_static_routes--next_hops))

docs/guides/changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ description: |-
1616
- Add missing options under `unsupported_features` attribute of `sdwan_configuration_group`, [link](https://github.com/CiscoDevNet/terraform-provider-sdwan/issues/478)
1717
- Add `sdwan_policy_group` resource and data source
1818
- Adds `enhanced_app_aware_routing` support to the `sdwan_cisco_system_feature_template` resource and data source
19+
- Add `gateway` attribute for `ipv4_static_routes` and `ipv6_static_routes` in `sdwan_service_lan_vpn_feature` resource
1920

2021
## 0.6.2
2122

docs/resources/service_lan_vpn_feature.md

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ resource "sdwan_service_lan_vpn_feature" "example" {
3838
{
3939
network_address = "1.2.3.4"
4040
subnet_mask = "0.0.0.0"
41+
gateway = "nextHop"
4142
next_hops = [
4243
{
4344
address = "1.2.3.4"
@@ -48,7 +49,8 @@ resource "sdwan_service_lan_vpn_feature" "example" {
4849
]
4950
ipv6_static_routes = [
5051
{
51-
prefix = "2001:0:0:1::0/12"
52+
prefix = "2001:0:0:1::0/12"
53+
gateway = "nextHop"
5254
next_hops = [
5355
{
5456
address = "2001:0:0:1::0"
@@ -323,16 +325,18 @@ Optional:
323325

324326
Optional:
325327

326-
- `gateway_dhcp` (Boolean) IPv4 Route Gateway DHCP
328+
- `dhcp` (Boolean) IPv4 Route Gateway DHCP, Attribute conditional on `gateway` being equal to `dhcp`
329+
- `gateway` (String) Gateway type
330+
- Choices: `nextHop`, `null0`, `vpn`, `dhcp`
327331
- `network_address` (String) IP Address
328332
- `network_address_variable` (String) Variable name
329-
- `next_hop_with_trackers` (Attributes List) IPv4 Route Gateway Next Hop with Tracker (see [below for nested schema](#nestedatt--ipv4_static_routes--next_hop_with_trackers))
330-
- `next_hops` (Attributes List) IPv4 Route Gateway Next Hop (see [below for nested schema](#nestedatt--ipv4_static_routes--next_hops))
331-
- `null0` (Boolean) IPv4 Route Gateway Next Hop
333+
- `next_hop_with_trackers` (Attributes List) IPv4 Route Gateway Next Hop with Tracker, Attribute conditional on `gateway` being equal to `nextHop` (see [below for nested schema](#nestedatt--ipv4_static_routes--next_hop_with_trackers))
334+
- `next_hops` (Attributes List) IPv4 Route Gateway Next Hop, Attribute conditional on `gateway` being equal to `nextHop` (see [below for nested schema](#nestedatt--ipv4_static_routes--next_hops))
335+
- `null0` (Boolean) IPv4 Route Gateway Next Hop, Attribute conditional on `gateway` being equal to `null0`
332336
- `subnet_mask` (String) Subnet Mask
333337
- Choices: `255.255.255.255`, `255.255.255.254`, `255.255.255.252`, `255.255.255.248`, `255.255.255.240`, `255.255.255.224`, `255.255.255.192`, `255.255.255.128`, `255.255.255.0`, `255.255.254.0`, `255.255.252.0`, `255.255.248.0`, `255.255.240.0`, `255.255.224.0`, `255.255.192.0`, `255.255.128.0`, `255.255.0.0`, `255.254.0.0`, `255.252.0.0`, `255.240.0.0`, `255.224.0.0`, `255.192.0.0`, `255.128.0.0`, `255.0.0.0`, `254.0.0.0`, `252.0.0.0`, `248.0.0.0`, `240.0.0.0`, `224.0.0.0`, `192.0.0.0`, `128.0.0.0`, `0.0.0.0`
334338
- `subnet_mask_variable` (String) Variable name
335-
- `vpn` (Boolean) IPv4 Route Gateway VPN
339+
- `vpn` (Boolean) IPv4 Route Gateway VPN, Attribute conditional on `gateway` being equal to `vpn`
336340

337341
<a id="nestedatt--ipv4_static_routes--next_hop_with_trackers"></a>
338342
### Nested Schema for `ipv4_static_routes.next_hop_with_trackers`
@@ -383,11 +387,13 @@ Optional:
383387

384388
Optional:
385389

386-
- `nat` (String) IPv6 Nat
390+
- `gateway` (String) Gateway type
391+
- Choices: `nextHop`, `null0`, `nat`
392+
- `nat` (String) IPv6 Nat, Attribute conditional on `gateway` being equal to `nat`
387393
- Choices: `NAT64`, `NAT66`
388-
- `nat_variable` (String) Variable name
389-
- `next_hops` (Attributes List) IPv6 Route Gateway Next Hop (see [below for nested schema](#nestedatt--ipv6_static_routes--next_hops))
390-
- `null0` (Boolean) IPv6 Route Gateway Next Hop
394+
- `nat_variable` (String) Variable name, Attribute conditional on `gateway` being equal to `nat`
395+
- `next_hops` (Attributes List) IPv6 Route Gateway Next Hop, Attribute conditional on `gateway` being equal to `nextHop` (see [below for nested schema](#nestedatt--ipv6_static_routes--next_hops))
396+
- `null0` (Boolean) IPv6 Route Gateway Next Hop, Attribute conditional on `gateway` being equal to `null0`
391397
- `prefix` (String) Prefix
392398
- `prefix_variable` (String) Variable name
393399

examples/resources/sdwan_service_lan_vpn_feature/resource.tf

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ resource "sdwan_service_lan_vpn_feature" "example" {
2121
{
2222
network_address = "1.2.3.4"
2323
subnet_mask = "0.0.0.0"
24+
gateway = "nextHop"
2425
next_hops = [
2526
{
2627
address = "1.2.3.4"
@@ -31,7 +32,8 @@ resource "sdwan_service_lan_vpn_feature" "example" {
3132
]
3233
ipv6_static_routes = [
3334
{
34-
prefix = "2001:0:0:1::0/12"
35+
prefix = "2001:0:0:1::0/12"
36+
gateway = "nextHop"
3537
next_hops = [
3638
{
3739
address = "2001:0:0:1::0"

gen/definitions/profile_parcels/service_lan_vpn.yaml

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,18 @@ attributes:
114114
- model_name: subnetMask
115115
data_path: [prefix]
116116
example: 0.0.0.0
117+
- tf_name: gateway
118+
type: String
119+
tf_only: true
120+
description: Gateway type
121+
enum_values: [nextHop, null0, vpn, dhcp]
122+
example: nextHop
117123
- model_name: nextHop
118124
tf_name: next_hops
119125
data_path: [oneOfIpRoute, nextHopContainer]
126+
conditional_attribute:
127+
name: gateway
128+
value: nextHop
120129
attributes:
121130
- model_name: address
122131
id: true
@@ -128,6 +137,9 @@ attributes:
128137
tf_name: next_hop_with_trackers
129138
data_path: [oneOfIpRoute, nextHopContainer]
130139
exclude_test: true
140+
conditional_attribute:
141+
name: gateway
142+
value: nextHop
131143
attributes:
132144
- model_name: address
133145
example: 1.2.3.4
@@ -142,24 +154,41 @@ attributes:
142154
data_path: [oneOfIpRoute]
143155
exclude_test: true
144156
example: false
157+
conditional_attribute:
158+
name: gateway
159+
value: null0
145160
- model_name: dhcp
146-
tf_name: gateway_dhcp
147161
data_path: [oneOfIpRoute]
148162
exclude_test: true
149163
example: false
164+
conditional_attribute:
165+
name: gateway
166+
value: dhcp
150167
- model_name: vpn
151168
data_path: [oneOfIpRoute]
152169
exclude_test: true
153170
example: false
171+
conditional_attribute:
172+
name: gateway
173+
value: vpn
154174
- model_name: ipv6Route
155175
tf_name: ipv6_static_routes
156176
attributes:
157177
- model_name: prefix
158178
id: true
159179
example: 2001:0:0:1::0/12
180+
- tf_name: gateway
181+
type: String
182+
tf_only: true
183+
description: Gateway type
184+
enum_values: [nextHop, null0, nat]
185+
example: nextHop
160186
- model_name: nextHop
161187
tf_name: next_hops
162188
data_path: [oneOfIpRoute, nextHopContainer]
189+
conditional_attribute:
190+
name: gateway
191+
value: nextHop
163192
attributes:
164193
- model_name: address
165194
id: true
@@ -170,11 +199,16 @@ attributes:
170199
- model_name: null0
171200
data_path: [oneOfIpRoute]
172201
exclude_test: true
173-
example: false
202+
conditional_attribute:
203+
name: gateway
204+
value: null0
174205
- model_name: nat
175206
data_path: [oneOfIpRoute]
176207
exclude_test: true
177208
example: NAT64
209+
conditional_attribute:
210+
name: gateway
211+
value: nat
178212
- model_name: service
179213
tf_name: services
180214
attributes:
@@ -344,7 +378,7 @@ attributes:
344378
exclude_test: true
345379
example: 1b270f6d-479b-47e3-ab0b-51bc6811a303
346380
- model_name: routeLeakBetweenServices
347-
tf_name: route_leak_from_other_services
381+
tf_name: route_leak_from_other_services
348382
exclude_test: true
349383
attributes:
350384
- model_name: sourceVpn
@@ -374,7 +408,7 @@ attributes:
374408
- model_name: rt
375409
tf_name: route_target
376410
id: true
377-
example: 1.1.1.3:200
411+
example: 1.1.1.3:200
378412
- model_name: exportRtList
379413
tf_name: ipv4_export_route_targets
380414
data_path: [mplsVpnIpv4RouteTarget]

gen/definitions/profile_parcels/transport_wan_vpn.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,23 +104,20 @@ attributes:
104104
- model_name: distance
105105
tf_name: administrative_distance
106106
example: 1
107-
108107
- model_name: null0
109108
data_path: [oneOfIpRoute]
110109
exclude_test: true
111110
conditional_attribute:
112111
name: gateway
113112
value: null0
114113
example: true
115-
116114
- model_name: nat
117115
data_path: [oneOfIpRoute]
118116
exclude_test: true
119117
conditional_attribute:
120118
name: gateway
121119
value: nat
122120
example: NAT64
123-
124121
- model_name: service
125122
tf_name: services
126123
attributes:

internal/provider/data_source_sdwan_service_lan_vpn_feature.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,10 @@ func (d *ServiceLANVPNProfileParcelDataSource) Schema(ctx context.Context, req d
298298
MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
299299
Computed: true,
300300
},
301+
"gateway": schema.StringAttribute{
302+
MarkdownDescription: "Gateway type",
303+
Computed: true,
304+
},
301305
"next_hops": schema.ListNestedAttribute{
302306
MarkdownDescription: "IPv4 Route Gateway Next Hop",
303307
Computed: true,
@@ -354,7 +358,7 @@ func (d *ServiceLANVPNProfileParcelDataSource) Schema(ctx context.Context, req d
354358
MarkdownDescription: "IPv4 Route Gateway Next Hop",
355359
Computed: true,
356360
},
357-
"gateway_dhcp": schema.BoolAttribute{
361+
"dhcp": schema.BoolAttribute{
358362
MarkdownDescription: "IPv4 Route Gateway DHCP",
359363
Computed: true,
360364
},
@@ -378,6 +382,10 @@ func (d *ServiceLANVPNProfileParcelDataSource) Schema(ctx context.Context, req d
378382
MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
379383
Computed: true,
380384
},
385+
"gateway": schema.StringAttribute{
386+
MarkdownDescription: "Gateway type",
387+
Computed: true,
388+
},
381389
"next_hops": schema.ListNestedAttribute{
382390
MarkdownDescription: "IPv6 Route Gateway Next Hop",
383391
Computed: true,

internal/provider/data_source_sdwan_service_lan_vpn_feature_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,13 +131,15 @@ func testAccDataSourceSdwanServiceLANVPNProfileParcelConfig() string {
131131
config += ` ipv4_static_routes = [{` + "\n"
132132
config += ` network_address = "1.2.3.4"` + "\n"
133133
config += ` subnet_mask = "0.0.0.0"` + "\n"
134+
config += ` gateway = "nextHop"` + "\n"
134135
config += ` next_hops = [{` + "\n"
135136
config += ` address = "1.2.3.4"` + "\n"
136137
config += ` administrative_distance = 1` + "\n"
137138
config += ` }]` + "\n"
138139
config += ` }]` + "\n"
139140
config += ` ipv6_static_routes = [{` + "\n"
140141
config += ` prefix = "2001:0:0:1::0/12"` + "\n"
142+
config += ` gateway = "nextHop"` + "\n"
141143
config += ` next_hops = [{` + "\n"
142144
config += ` address = "2001:0:0:1::0"` + "\n"
143145
config += ` administrative_distance = 1` + "\n"

0 commit comments

Comments
 (0)