Skip to content

Commit 537c2d8

Browse files
committed
fix
1 parent 3f841c0 commit 537c2d8

File tree

7 files changed

+103
-55
lines changed

7 files changed

+103
-55
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.6.3 (Unreleased)
2+
3+
- Fix issue, where NAT is always configured on `sdwan_transport_wan_vpn_interface_ethernet_feature`, [link](https://github.com/CiscoDevNet/terraform-provider-sdwan/issues/485)
4+
15
## 0.6.2
26

37
- Fix issue causing changes to applied feature templates to fail, [link](https://github.com/CiscoDevNet/terraform-provider-sdwan/issues/417)

docs/guides/changelog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ description: |-
77

88
# Changelog
99

10+
## 0.6.3 (Unreleased)
11+
12+
- Fix issue, where NAT is always configured on `sdwan_transport_wan_vpn_interface_ethernet_feature`, [link](https://github.com/CiscoDevNet/terraform-provider-sdwan/issues/485)
13+
1014
## 0.6.2
1115

1216
- Fix issue causing changes to applied feature templates to fail, [link](https://github.com/CiscoDevNet/terraform-provider-sdwan/issues/417)

docs/resources/transport_wan_vpn_interface_ethernet_feature.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -238,31 +238,31 @@ resource "sdwan_transport_wan_vpn_interface_ethernet_feature" "example" {
238238
- `nat_ipv6` (Boolean) enable Network Address Translation ipv6 on this interface
239239
- Default value: `false`
240240
- `nat_ipv6_variable` (String) Variable name
241-
- `nat_loopback` (String) NAT Inside Source Loopback Interface
242-
- `nat_loopback_variable` (String) Variable name
243-
- `nat_overload` (Boolean) NAT Overload
241+
- `nat_loopback` (String) NAT Inside Source Loopback Interface, Attribute conditional on `nat_ipv4` being equal to `true`
242+
- `nat_loopback_variable` (String) Variable name, Attribute conditional on `nat_ipv4` being equal to `true`
243+
- `nat_overload` (Boolean) NAT Overload, Attribute conditional on `nat_ipv4` being equal to `true`
244244
- Default value: `true`
245-
- `nat_overload_variable` (String) Variable name
246-
- `nat_prefix_length` (Number) NAT Pool Prefix Length
245+
- `nat_overload_variable` (String) Variable name, Attribute conditional on `nat_ipv4` being equal to `true`
246+
- `nat_prefix_length` (Number) NAT Pool Prefix Length, Attribute conditional on `nat_ipv4` being equal to `true`
247247
- Range: `1`-`32`
248-
- `nat_prefix_length_variable` (String) Variable name
249-
- `nat_range_end` (String) NAT Pool Range End
250-
- `nat_range_end_variable` (String) Variable name
251-
- `nat_range_start` (String) NAT Pool Range Start
252-
- `nat_range_start_variable` (String) Variable name
253-
- `nat_tcp_timeout` (Number) Set NAT TCP session timeout, in minutes
248+
- `nat_prefix_length_variable` (String) Variable name, Attribute conditional on `nat_ipv4` being equal to `true`
249+
- `nat_range_end` (String) NAT Pool Range End, Attribute conditional on `nat_ipv4` being equal to `true`
250+
- `nat_range_end_variable` (String) Variable name, Attribute conditional on `nat_ipv4` being equal to `true`
251+
- `nat_range_start` (String) NAT Pool Range Start, Attribute conditional on `nat_ipv4` being equal to `true`
252+
- `nat_range_start_variable` (String) Variable name, Attribute conditional on `nat_ipv4` being equal to `true`
253+
- `nat_tcp_timeout` (Number) Set NAT TCP session timeout, in minutes, Attribute conditional on `nat_ipv4` being equal to `true`
254254
- Range: `1`-`8947`
255255
- Default value: `60`
256-
- `nat_tcp_timeout_variable` (String) Variable name
257-
- `nat_type` (String) NAT Type
256+
- `nat_tcp_timeout_variable` (String) Variable name, Attribute conditional on `nat_ipv4` being equal to `true`
257+
- `nat_type` (String) NAT Type, Attribute conditional on `nat_ipv4` being equal to `true`
258258
- Choices: `interface`, `pool`, `loopback`
259259
- Default value: `interface`
260-
- `nat_type_variable` (String) Variable name
261-
- `nat_udp_timeout` (Number) Set NAT UDP session timeout, in minutes
260+
- `nat_type_variable` (String) Variable name, Attribute conditional on `nat_ipv4` being equal to `true`
261+
- `nat_udp_timeout` (Number) Set NAT UDP session timeout, in minutes, Attribute conditional on `nat_ipv4` being equal to `true`
262262
- Range: `1`-`8947`
263263
- Default value: `1`
264-
- `nat_udp_timeout_variable` (String) Variable name
265-
- `new_static_nats` (Attributes List) static NAT (see [below for nested schema](#nestedatt--new_static_nats))
264+
- `nat_udp_timeout_variable` (String) Variable name, Attribute conditional on `nat_ipv4` being equal to `true`
265+
- `new_static_nats` (Attributes List) static NAT, Attribute conditional on `nat_ipv4` being equal to `true` (see [below for nested schema](#nestedatt--new_static_nats))
266266
- `per_tunnel_qos` (Boolean) Per-tunnel Qos
267267
- Default value: `false`
268268
- `per_tunnel_qos_variable` (String) Variable name

gen/definitions/profile_parcels/transport_wan_vpn_interface_ethernet.yaml

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,12 +325,20 @@ attributes:
325325
- model_name: natType
326326
tf_name: nat_type
327327
data_path: [natAttributesIpv4]
328-
example: interface
328+
example: interface
329+
conditional_attribute:
330+
name: nat_ipv4
331+
value: true
332+
type: Bool
329333
- model_name: rangeStart
330334
tf_name: nat_range_start
331335
data_path: [natAttributesIpv4, natPool]
332336
exclude_test: true
333337
exclude_null: true
338+
conditional_attribute:
339+
name: nat_ipv4
340+
value: true
341+
type: Bool
334342
# conditional_attribute:
335343
# name: natType
336344
# value: pool
@@ -340,6 +348,10 @@ attributes:
340348
data_path: [natAttributesIpv4, natPool]
341349
exclude_test: true
342350
exclude_null: true
351+
conditional_attribute:
352+
name: nat_ipv4
353+
value: true
354+
type: Bool
343355
# conditional_attribute:
344356
# name: natType
345357
# value: pool
@@ -349,6 +361,10 @@ attributes:
349361
data_path: [natAttributesIpv4, natPool]
350362
exclude_test: true
351363
exclude_null: true
364+
conditional_attribute:
365+
name: nat_ipv4
366+
value: true
367+
type: Bool
352368
# conditional_attribute:
353369
# name: natType
354370
# value: pool
@@ -358,6 +374,10 @@ attributes:
358374
data_path: [natAttributesIpv4, natPool]
359375
exclude_test: true
360376
exclude_null: true
377+
conditional_attribute:
378+
name: nat_ipv4
379+
value: true
380+
type: Bool
361381
# conditional_attribute:
362382
# name: natType
363383
# value: pool
@@ -367,6 +387,10 @@ attributes:
367387
data_path: [natAttributesIpv4]
368388
exclude_test: true
369389
exclude_null: true
390+
conditional_attribute:
391+
name: nat_ipv4
392+
value: true
393+
type: Bool
370394
# conditional_attribute:
371395
# name: natType
372396
# value: loopback
@@ -375,13 +399,25 @@ attributes:
375399
tf_name: nat_udp_timeout
376400
data_path: [natAttributesIpv4]
377401
example: 1
402+
conditional_attribute:
403+
name: nat_ipv4
404+
value: true
405+
type: Bool
378406
- model_name: tcpTimeout
379407
tf_name: nat_tcp_timeout
380408
data_path: [natAttributesIpv4]
381409
example: 60
410+
conditional_attribute:
411+
name: nat_ipv4
412+
value: true
413+
type: Bool
382414
- model_name: newStaticNat
383415
tf_name: new_static_nats
384416
data_path: [natAttributesIpv4]
417+
conditional_attribute:
418+
name: nat_ipv4
419+
value: true
420+
type: Bool
385421
attributes:
386422
- model_name: sourceIp
387423
id: true

internal/provider/model_sdwan_transport_wan_vpn_interface_ethernet_feature.go

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1292,116 +1292,116 @@ func (data TransportWANVPNInterfaceEthernet) toBody(ctx context.Context) string
12921292
}
12931293

12941294
if !data.NatTypeVariable.IsNull() {
1295-
if true {
1295+
if true && data.NatIpv4.ValueBool() == true {
12961296
body, _ = sjson.Set(body, path+"natAttributesIpv4.natType.optionType", "variable")
12971297
body, _ = sjson.Set(body, path+"natAttributesIpv4.natType.value", data.NatTypeVariable.ValueString())
12981298
}
12991299
} else if data.NatType.IsNull() {
1300-
if true {
1300+
if true && data.NatIpv4.ValueBool() == true {
13011301
body, _ = sjson.Set(body, path+"natAttributesIpv4.natType.optionType", "default")
13021302
body, _ = sjson.Set(body, path+"natAttributesIpv4.natType.value", "interface")
13031303
}
13041304
} else {
1305-
if true {
1305+
if true && data.NatIpv4.ValueBool() == true {
13061306
body, _ = sjson.Set(body, path+"natAttributesIpv4.natType.optionType", "global")
13071307
body, _ = sjson.Set(body, path+"natAttributesIpv4.natType.value", data.NatType.ValueString())
13081308
}
13091309
}
13101310

13111311
if !data.NatRangeStartVariable.IsNull() {
1312-
if true {
1312+
if true && data.NatIpv4.ValueBool() == true {
13131313
body, _ = sjson.Set(body, path+"natAttributesIpv4.natPool.rangeStart.optionType", "variable")
13141314
body, _ = sjson.Set(body, path+"natAttributesIpv4.natPool.rangeStart.value", data.NatRangeStartVariable.ValueString())
13151315
}
13161316
} else if !data.NatRangeStart.IsNull() {
1317-
if true {
1317+
if true && data.NatIpv4.ValueBool() == true {
13181318
body, _ = sjson.Set(body, path+"natAttributesIpv4.natPool.rangeStart.optionType", "global")
13191319
body, _ = sjson.Set(body, path+"natAttributesIpv4.natPool.rangeStart.value", data.NatRangeStart.ValueString())
13201320
}
13211321
}
13221322

13231323
if !data.NatRangeEndVariable.IsNull() {
1324-
if true {
1324+
if true && data.NatIpv4.ValueBool() == true {
13251325
body, _ = sjson.Set(body, path+"natAttributesIpv4.natPool.rangeEnd.optionType", "variable")
13261326
body, _ = sjson.Set(body, path+"natAttributesIpv4.natPool.rangeEnd.value", data.NatRangeEndVariable.ValueString())
13271327
}
13281328
} else if !data.NatRangeEnd.IsNull() {
1329-
if true {
1329+
if true && data.NatIpv4.ValueBool() == true {
13301330
body, _ = sjson.Set(body, path+"natAttributesIpv4.natPool.rangeEnd.optionType", "global")
13311331
body, _ = sjson.Set(body, path+"natAttributesIpv4.natPool.rangeEnd.value", data.NatRangeEnd.ValueString())
13321332
}
13331333
}
13341334

13351335
if !data.NatPrefixLengthVariable.IsNull() {
1336-
if true {
1336+
if true && data.NatIpv4.ValueBool() == true {
13371337
body, _ = sjson.Set(body, path+"natAttributesIpv4.natPool.prefixLength.optionType", "variable")
13381338
body, _ = sjson.Set(body, path+"natAttributesIpv4.natPool.prefixLength.value", data.NatPrefixLengthVariable.ValueString())
13391339
}
13401340
} else if !data.NatPrefixLength.IsNull() {
1341-
if true {
1341+
if true && data.NatIpv4.ValueBool() == true {
13421342
body, _ = sjson.Set(body, path+"natAttributesIpv4.natPool.prefixLength.optionType", "global")
13431343
body, _ = sjson.Set(body, path+"natAttributesIpv4.natPool.prefixLength.value", data.NatPrefixLength.ValueInt64())
13441344
}
13451345
}
13461346

13471347
if !data.NatOverloadVariable.IsNull() {
1348-
if true {
1348+
if true && data.NatIpv4.ValueBool() == true {
13491349
body, _ = sjson.Set(body, path+"natAttributesIpv4.natPool.overload.optionType", "variable")
13501350
body, _ = sjson.Set(body, path+"natAttributesIpv4.natPool.overload.value", data.NatOverloadVariable.ValueString())
13511351
}
13521352
} else if !data.NatOverload.IsNull() {
1353-
if true {
1353+
if true && data.NatIpv4.ValueBool() == true {
13541354
body, _ = sjson.Set(body, path+"natAttributesIpv4.natPool.overload.optionType", "global")
13551355
body, _ = sjson.Set(body, path+"natAttributesIpv4.natPool.overload.value", data.NatOverload.ValueBool())
13561356
}
13571357
}
13581358

13591359
if !data.NatLoopbackVariable.IsNull() {
1360-
if true {
1360+
if true && data.NatIpv4.ValueBool() == true {
13611361
body, _ = sjson.Set(body, path+"natAttributesIpv4.natLookback.optionType", "variable")
13621362
body, _ = sjson.Set(body, path+"natAttributesIpv4.natLookback.value", data.NatLoopbackVariable.ValueString())
13631363
}
13641364
} else if !data.NatLoopback.IsNull() {
1365-
if true {
1365+
if true && data.NatIpv4.ValueBool() == true {
13661366
body, _ = sjson.Set(body, path+"natAttributesIpv4.natLookback.optionType", "global")
13671367
body, _ = sjson.Set(body, path+"natAttributesIpv4.natLookback.value", data.NatLoopback.ValueString())
13681368
}
13691369
}
13701370

13711371
if !data.NatUdpTimeoutVariable.IsNull() {
1372-
if true {
1372+
if true && data.NatIpv4.ValueBool() == true {
13731373
body, _ = sjson.Set(body, path+"natAttributesIpv4.udpTimeout.optionType", "variable")
13741374
body, _ = sjson.Set(body, path+"natAttributesIpv4.udpTimeout.value", data.NatUdpTimeoutVariable.ValueString())
13751375
}
13761376
} else if data.NatUdpTimeout.IsNull() {
1377-
if true {
1377+
if true && data.NatIpv4.ValueBool() == true {
13781378
body, _ = sjson.Set(body, path+"natAttributesIpv4.udpTimeout.optionType", "default")
13791379
body, _ = sjson.Set(body, path+"natAttributesIpv4.udpTimeout.value", 1)
13801380
}
13811381
} else {
1382-
if true {
1382+
if true && data.NatIpv4.ValueBool() == true {
13831383
body, _ = sjson.Set(body, path+"natAttributesIpv4.udpTimeout.optionType", "global")
13841384
body, _ = sjson.Set(body, path+"natAttributesIpv4.udpTimeout.value", data.NatUdpTimeout.ValueInt64())
13851385
}
13861386
}
13871387

13881388
if !data.NatTcpTimeoutVariable.IsNull() {
1389-
if true {
1389+
if true && data.NatIpv4.ValueBool() == true {
13901390
body, _ = sjson.Set(body, path+"natAttributesIpv4.tcpTimeout.optionType", "variable")
13911391
body, _ = sjson.Set(body, path+"natAttributesIpv4.tcpTimeout.value", data.NatTcpTimeoutVariable.ValueString())
13921392
}
13931393
} else if data.NatTcpTimeout.IsNull() {
1394-
if true {
1394+
if true && data.NatIpv4.ValueBool() == true {
13951395
body, _ = sjson.Set(body, path+"natAttributesIpv4.tcpTimeout.optionType", "default")
13961396
body, _ = sjson.Set(body, path+"natAttributesIpv4.tcpTimeout.value", 60)
13971397
}
13981398
} else {
1399-
if true {
1399+
if true && data.NatIpv4.ValueBool() == true {
14001400
body, _ = sjson.Set(body, path+"natAttributesIpv4.tcpTimeout.optionType", "global")
14011401
body, _ = sjson.Set(body, path+"natAttributesIpv4.tcpTimeout.value", data.NatTcpTimeout.ValueInt64())
14021402
}
14031403
}
1404-
if true {
1404+
if true && data.NatIpv4.ValueBool() == true {
14051405
body, _ = sjson.Set(body, path+"natAttributesIpv4.newStaticNat", []interface{}{})
14061406
for _, item := range data.NewStaticNats {
14071407
itemBody := ""

0 commit comments

Comments
 (0)