From 537c2d878f9ae21345fafcf561216988b597dd7e Mon Sep 17 00:00:00 2001 From: Rafal Chrabaszcz Date: Tue, 29 Jul 2025 17:55:13 +0200 Subject: [PATCH 1/3] fix --- CHANGELOG.md | 4 ++ docs/guides/changelog.md | 4 ++ ...port_wan_vpn_interface_ethernet_feature.md | 34 ++++++++-------- .../transport_wan_vpn_interface_ethernet.yaml | 38 +++++++++++++++++- ...port_wan_vpn_interface_ethernet_feature.go | 40 +++++++++---------- ...port_wan_vpn_interface_ethernet_feature.go | 34 ++++++++-------- templates/guides/changelog.md.tmpl | 4 ++ 7 files changed, 103 insertions(+), 55 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b2b49d57..d464be664 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.6.3 (Unreleased) + +- 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) + ## 0.6.2 - Fix issue causing changes to applied feature templates to fail, [link](https://github.com/CiscoDevNet/terraform-provider-sdwan/issues/417) diff --git a/docs/guides/changelog.md b/docs/guides/changelog.md index 3805e503e..e7d230649 100644 --- a/docs/guides/changelog.md +++ b/docs/guides/changelog.md @@ -7,6 +7,10 @@ description: |- # Changelog +## 0.6.3 (Unreleased) + +- 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) + ## 0.6.2 - Fix issue causing changes to applied feature templates to fail, [link](https://github.com/CiscoDevNet/terraform-provider-sdwan/issues/417) diff --git a/docs/resources/transport_wan_vpn_interface_ethernet_feature.md b/docs/resources/transport_wan_vpn_interface_ethernet_feature.md index 940ca4721..6770a76e4 100644 --- a/docs/resources/transport_wan_vpn_interface_ethernet_feature.md +++ b/docs/resources/transport_wan_vpn_interface_ethernet_feature.md @@ -238,31 +238,31 @@ resource "sdwan_transport_wan_vpn_interface_ethernet_feature" "example" { - `nat_ipv6` (Boolean) enable Network Address Translation ipv6 on this interface - Default value: `false` - `nat_ipv6_variable` (String) Variable name -- `nat_loopback` (String) NAT Inside Source Loopback Interface -- `nat_loopback_variable` (String) Variable name -- `nat_overload` (Boolean) NAT Overload +- `nat_loopback` (String) NAT Inside Source Loopback Interface, Attribute conditional on `nat_ipv4` being equal to `true` +- `nat_loopback_variable` (String) Variable name, Attribute conditional on `nat_ipv4` being equal to `true` +- `nat_overload` (Boolean) NAT Overload, Attribute conditional on `nat_ipv4` being equal to `true` - Default value: `true` -- `nat_overload_variable` (String) Variable name -- `nat_prefix_length` (Number) NAT Pool Prefix Length +- `nat_overload_variable` (String) Variable name, Attribute conditional on `nat_ipv4` being equal to `true` +- `nat_prefix_length` (Number) NAT Pool Prefix Length, Attribute conditional on `nat_ipv4` being equal to `true` - Range: `1`-`32` -- `nat_prefix_length_variable` (String) Variable name -- `nat_range_end` (String) NAT Pool Range End -- `nat_range_end_variable` (String) Variable name -- `nat_range_start` (String) NAT Pool Range Start -- `nat_range_start_variable` (String) Variable name -- `nat_tcp_timeout` (Number) Set NAT TCP session timeout, in minutes +- `nat_prefix_length_variable` (String) Variable name, Attribute conditional on `nat_ipv4` being equal to `true` +- `nat_range_end` (String) NAT Pool Range End, Attribute conditional on `nat_ipv4` being equal to `true` +- `nat_range_end_variable` (String) Variable name, Attribute conditional on `nat_ipv4` being equal to `true` +- `nat_range_start` (String) NAT Pool Range Start, Attribute conditional on `nat_ipv4` being equal to `true` +- `nat_range_start_variable` (String) Variable name, Attribute conditional on `nat_ipv4` being equal to `true` +- `nat_tcp_timeout` (Number) Set NAT TCP session timeout, in minutes, Attribute conditional on `nat_ipv4` being equal to `true` - Range: `1`-`8947` - Default value: `60` -- `nat_tcp_timeout_variable` (String) Variable name -- `nat_type` (String) NAT Type +- `nat_tcp_timeout_variable` (String) Variable name, Attribute conditional on `nat_ipv4` being equal to `true` +- `nat_type` (String) NAT Type, Attribute conditional on `nat_ipv4` being equal to `true` - Choices: `interface`, `pool`, `loopback` - Default value: `interface` -- `nat_type_variable` (String) Variable name -- `nat_udp_timeout` (Number) Set NAT UDP session timeout, in minutes +- `nat_type_variable` (String) Variable name, Attribute conditional on `nat_ipv4` being equal to `true` +- `nat_udp_timeout` (Number) Set NAT UDP session timeout, in minutes, Attribute conditional on `nat_ipv4` being equal to `true` - Range: `1`-`8947` - Default value: `1` -- `nat_udp_timeout_variable` (String) Variable name -- `new_static_nats` (Attributes List) static NAT (see [below for nested schema](#nestedatt--new_static_nats)) +- `nat_udp_timeout_variable` (String) Variable name, Attribute conditional on `nat_ipv4` being equal to `true` +- `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)) - `per_tunnel_qos` (Boolean) Per-tunnel Qos - Default value: `false` - `per_tunnel_qos_variable` (String) Variable name diff --git a/gen/definitions/profile_parcels/transport_wan_vpn_interface_ethernet.yaml b/gen/definitions/profile_parcels/transport_wan_vpn_interface_ethernet.yaml index a9c94ff78..23b8e0703 100644 --- a/gen/definitions/profile_parcels/transport_wan_vpn_interface_ethernet.yaml +++ b/gen/definitions/profile_parcels/transport_wan_vpn_interface_ethernet.yaml @@ -325,12 +325,20 @@ attributes: - model_name: natType tf_name: nat_type data_path: [natAttributesIpv4] - example: interface + example: interface + conditional_attribute: + name: nat_ipv4 + value: true + type: Bool - model_name: rangeStart tf_name: nat_range_start data_path: [natAttributesIpv4, natPool] exclude_test: true exclude_null: true + conditional_attribute: + name: nat_ipv4 + value: true + type: Bool # conditional_attribute: # name: natType # value: pool @@ -340,6 +348,10 @@ attributes: data_path: [natAttributesIpv4, natPool] exclude_test: true exclude_null: true + conditional_attribute: + name: nat_ipv4 + value: true + type: Bool # conditional_attribute: # name: natType # value: pool @@ -349,6 +361,10 @@ attributes: data_path: [natAttributesIpv4, natPool] exclude_test: true exclude_null: true + conditional_attribute: + name: nat_ipv4 + value: true + type: Bool # conditional_attribute: # name: natType # value: pool @@ -358,6 +374,10 @@ attributes: data_path: [natAttributesIpv4, natPool] exclude_test: true exclude_null: true + conditional_attribute: + name: nat_ipv4 + value: true + type: Bool # conditional_attribute: # name: natType # value: pool @@ -367,6 +387,10 @@ attributes: data_path: [natAttributesIpv4] exclude_test: true exclude_null: true + conditional_attribute: + name: nat_ipv4 + value: true + type: Bool # conditional_attribute: # name: natType # value: loopback @@ -375,13 +399,25 @@ attributes: tf_name: nat_udp_timeout data_path: [natAttributesIpv4] example: 1 + conditional_attribute: + name: nat_ipv4 + value: true + type: Bool - model_name: tcpTimeout tf_name: nat_tcp_timeout data_path: [natAttributesIpv4] example: 60 + conditional_attribute: + name: nat_ipv4 + value: true + type: Bool - model_name: newStaticNat tf_name: new_static_nats data_path: [natAttributesIpv4] + conditional_attribute: + name: nat_ipv4 + value: true + type: Bool attributes: - model_name: sourceIp id: true diff --git a/internal/provider/model_sdwan_transport_wan_vpn_interface_ethernet_feature.go b/internal/provider/model_sdwan_transport_wan_vpn_interface_ethernet_feature.go index 820bde268..75f180817 100644 --- a/internal/provider/model_sdwan_transport_wan_vpn_interface_ethernet_feature.go +++ b/internal/provider/model_sdwan_transport_wan_vpn_interface_ethernet_feature.go @@ -1292,116 +1292,116 @@ func (data TransportWANVPNInterfaceEthernet) toBody(ctx context.Context) string } if !data.NatTypeVariable.IsNull() { - if true { + if true && data.NatIpv4.ValueBool() == true { body, _ = sjson.Set(body, path+"natAttributesIpv4.natType.optionType", "variable") body, _ = sjson.Set(body, path+"natAttributesIpv4.natType.value", data.NatTypeVariable.ValueString()) } } else if data.NatType.IsNull() { - if true { + if true && data.NatIpv4.ValueBool() == true { body, _ = sjson.Set(body, path+"natAttributesIpv4.natType.optionType", "default") body, _ = sjson.Set(body, path+"natAttributesIpv4.natType.value", "interface") } } else { - if true { + if true && data.NatIpv4.ValueBool() == true { body, _ = sjson.Set(body, path+"natAttributesIpv4.natType.optionType", "global") body, _ = sjson.Set(body, path+"natAttributesIpv4.natType.value", data.NatType.ValueString()) } } if !data.NatRangeStartVariable.IsNull() { - if true { + if true && data.NatIpv4.ValueBool() == true { body, _ = sjson.Set(body, path+"natAttributesIpv4.natPool.rangeStart.optionType", "variable") body, _ = sjson.Set(body, path+"natAttributesIpv4.natPool.rangeStart.value", data.NatRangeStartVariable.ValueString()) } } else if !data.NatRangeStart.IsNull() { - if true { + if true && data.NatIpv4.ValueBool() == true { body, _ = sjson.Set(body, path+"natAttributesIpv4.natPool.rangeStart.optionType", "global") body, _ = sjson.Set(body, path+"natAttributesIpv4.natPool.rangeStart.value", data.NatRangeStart.ValueString()) } } if !data.NatRangeEndVariable.IsNull() { - if true { + if true && data.NatIpv4.ValueBool() == true { body, _ = sjson.Set(body, path+"natAttributesIpv4.natPool.rangeEnd.optionType", "variable") body, _ = sjson.Set(body, path+"natAttributesIpv4.natPool.rangeEnd.value", data.NatRangeEndVariable.ValueString()) } } else if !data.NatRangeEnd.IsNull() { - if true { + if true && data.NatIpv4.ValueBool() == true { body, _ = sjson.Set(body, path+"natAttributesIpv4.natPool.rangeEnd.optionType", "global") body, _ = sjson.Set(body, path+"natAttributesIpv4.natPool.rangeEnd.value", data.NatRangeEnd.ValueString()) } } if !data.NatPrefixLengthVariable.IsNull() { - if true { + if true && data.NatIpv4.ValueBool() == true { body, _ = sjson.Set(body, path+"natAttributesIpv4.natPool.prefixLength.optionType", "variable") body, _ = sjson.Set(body, path+"natAttributesIpv4.natPool.prefixLength.value", data.NatPrefixLengthVariable.ValueString()) } } else if !data.NatPrefixLength.IsNull() { - if true { + if true && data.NatIpv4.ValueBool() == true { body, _ = sjson.Set(body, path+"natAttributesIpv4.natPool.prefixLength.optionType", "global") body, _ = sjson.Set(body, path+"natAttributesIpv4.natPool.prefixLength.value", data.NatPrefixLength.ValueInt64()) } } if !data.NatOverloadVariable.IsNull() { - if true { + if true && data.NatIpv4.ValueBool() == true { body, _ = sjson.Set(body, path+"natAttributesIpv4.natPool.overload.optionType", "variable") body, _ = sjson.Set(body, path+"natAttributesIpv4.natPool.overload.value", data.NatOverloadVariable.ValueString()) } } else if !data.NatOverload.IsNull() { - if true { + if true && data.NatIpv4.ValueBool() == true { body, _ = sjson.Set(body, path+"natAttributesIpv4.natPool.overload.optionType", "global") body, _ = sjson.Set(body, path+"natAttributesIpv4.natPool.overload.value", data.NatOverload.ValueBool()) } } if !data.NatLoopbackVariable.IsNull() { - if true { + if true && data.NatIpv4.ValueBool() == true { body, _ = sjson.Set(body, path+"natAttributesIpv4.natLookback.optionType", "variable") body, _ = sjson.Set(body, path+"natAttributesIpv4.natLookback.value", data.NatLoopbackVariable.ValueString()) } } else if !data.NatLoopback.IsNull() { - if true { + if true && data.NatIpv4.ValueBool() == true { body, _ = sjson.Set(body, path+"natAttributesIpv4.natLookback.optionType", "global") body, _ = sjson.Set(body, path+"natAttributesIpv4.natLookback.value", data.NatLoopback.ValueString()) } } if !data.NatUdpTimeoutVariable.IsNull() { - if true { + if true && data.NatIpv4.ValueBool() == true { body, _ = sjson.Set(body, path+"natAttributesIpv4.udpTimeout.optionType", "variable") body, _ = sjson.Set(body, path+"natAttributesIpv4.udpTimeout.value", data.NatUdpTimeoutVariable.ValueString()) } } else if data.NatUdpTimeout.IsNull() { - if true { + if true && data.NatIpv4.ValueBool() == true { body, _ = sjson.Set(body, path+"natAttributesIpv4.udpTimeout.optionType", "default") body, _ = sjson.Set(body, path+"natAttributesIpv4.udpTimeout.value", 1) } } else { - if true { + if true && data.NatIpv4.ValueBool() == true { body, _ = sjson.Set(body, path+"natAttributesIpv4.udpTimeout.optionType", "global") body, _ = sjson.Set(body, path+"natAttributesIpv4.udpTimeout.value", data.NatUdpTimeout.ValueInt64()) } } if !data.NatTcpTimeoutVariable.IsNull() { - if true { + if true && data.NatIpv4.ValueBool() == true { body, _ = sjson.Set(body, path+"natAttributesIpv4.tcpTimeout.optionType", "variable") body, _ = sjson.Set(body, path+"natAttributesIpv4.tcpTimeout.value", data.NatTcpTimeoutVariable.ValueString()) } } else if data.NatTcpTimeout.IsNull() { - if true { + if true && data.NatIpv4.ValueBool() == true { body, _ = sjson.Set(body, path+"natAttributesIpv4.tcpTimeout.optionType", "default") body, _ = sjson.Set(body, path+"natAttributesIpv4.tcpTimeout.value", 60) } } else { - if true { + if true && data.NatIpv4.ValueBool() == true { body, _ = sjson.Set(body, path+"natAttributesIpv4.tcpTimeout.optionType", "global") body, _ = sjson.Set(body, path+"natAttributesIpv4.tcpTimeout.value", data.NatTcpTimeout.ValueInt64()) } } - if true { + if true && data.NatIpv4.ValueBool() == true { body, _ = sjson.Set(body, path+"natAttributesIpv4.newStaticNat", []interface{}{}) for _, item := range data.NewStaticNats { itemBody := "" diff --git a/internal/provider/resource_sdwan_transport_wan_vpn_interface_ethernet_feature.go b/internal/provider/resource_sdwan_transport_wan_vpn_interface_ethernet_feature.go index 2ec226fc2..cc334d173 100644 --- a/internal/provider/resource_sdwan_transport_wan_vpn_interface_ethernet_feature.go +++ b/internal/provider/resource_sdwan_transport_wan_vpn_interface_ethernet_feature.go @@ -689,86 +689,86 @@ func (r *TransportWANVPNInterfaceEthernetProfileParcelResource) Schema(ctx conte Optional: true, }, "nat_type": schema.StringAttribute{ - MarkdownDescription: helpers.NewAttributeDescription("NAT Type").AddStringEnumDescription("interface", "pool", "loopback").AddDefaultValueDescription("interface").String, + MarkdownDescription: helpers.NewAttributeDescription("NAT Type, Attribute conditional on `nat_ipv4` being equal to `true`").AddStringEnumDescription("interface", "pool", "loopback").AddDefaultValueDescription("interface").String, Optional: true, Validators: []validator.String{ stringvalidator.OneOf("interface", "pool", "loopback"), }, }, "nat_type_variable": schema.StringAttribute{ - MarkdownDescription: helpers.NewAttributeDescription("Variable name").String, + MarkdownDescription: helpers.NewAttributeDescription("Variable name, Attribute conditional on `nat_ipv4` being equal to `true`").String, Optional: true, }, "nat_range_start": schema.StringAttribute{ - MarkdownDescription: helpers.NewAttributeDescription("NAT Pool Range Start").String, + MarkdownDescription: helpers.NewAttributeDescription("NAT Pool Range Start, Attribute conditional on `nat_ipv4` being equal to `true`").String, Optional: true, }, "nat_range_start_variable": schema.StringAttribute{ - MarkdownDescription: helpers.NewAttributeDescription("Variable name").String, + MarkdownDescription: helpers.NewAttributeDescription("Variable name, Attribute conditional on `nat_ipv4` being equal to `true`").String, Optional: true, }, "nat_range_end": schema.StringAttribute{ - MarkdownDescription: helpers.NewAttributeDescription("NAT Pool Range End").String, + MarkdownDescription: helpers.NewAttributeDescription("NAT Pool Range End, Attribute conditional on `nat_ipv4` being equal to `true`").String, Optional: true, }, "nat_range_end_variable": schema.StringAttribute{ - MarkdownDescription: helpers.NewAttributeDescription("Variable name").String, + MarkdownDescription: helpers.NewAttributeDescription("Variable name, Attribute conditional on `nat_ipv4` being equal to `true`").String, Optional: true, }, "nat_prefix_length": schema.Int64Attribute{ - MarkdownDescription: helpers.NewAttributeDescription("NAT Pool Prefix Length").AddIntegerRangeDescription(1, 32).String, + MarkdownDescription: helpers.NewAttributeDescription("NAT Pool Prefix Length, Attribute conditional on `nat_ipv4` being equal to `true`").AddIntegerRangeDescription(1, 32).String, Optional: true, Validators: []validator.Int64{ int64validator.Between(1, 32), }, }, "nat_prefix_length_variable": schema.StringAttribute{ - MarkdownDescription: helpers.NewAttributeDescription("Variable name").String, + MarkdownDescription: helpers.NewAttributeDescription("Variable name, Attribute conditional on `nat_ipv4` being equal to `true`").String, Optional: true, }, "nat_overload": schema.BoolAttribute{ - MarkdownDescription: helpers.NewAttributeDescription("NAT Overload").AddDefaultValueDescription("true").String, + MarkdownDescription: helpers.NewAttributeDescription("NAT Overload, Attribute conditional on `nat_ipv4` being equal to `true`").AddDefaultValueDescription("true").String, Optional: true, }, "nat_overload_variable": schema.StringAttribute{ - MarkdownDescription: helpers.NewAttributeDescription("Variable name").String, + MarkdownDescription: helpers.NewAttributeDescription("Variable name, Attribute conditional on `nat_ipv4` being equal to `true`").String, Optional: true, }, "nat_loopback": schema.StringAttribute{ - MarkdownDescription: helpers.NewAttributeDescription("NAT Inside Source Loopback Interface").String, + MarkdownDescription: helpers.NewAttributeDescription("NAT Inside Source Loopback Interface, Attribute conditional on `nat_ipv4` being equal to `true`").String, Optional: true, Validators: []validator.String{ stringvalidator.LengthBetween(1, 32), }, }, "nat_loopback_variable": schema.StringAttribute{ - MarkdownDescription: helpers.NewAttributeDescription("Variable name").String, + MarkdownDescription: helpers.NewAttributeDescription("Variable name, Attribute conditional on `nat_ipv4` being equal to `true`").String, Optional: true, }, "nat_udp_timeout": schema.Int64Attribute{ - MarkdownDescription: helpers.NewAttributeDescription("Set NAT UDP session timeout, in minutes").AddIntegerRangeDescription(1, 8947).AddDefaultValueDescription("1").String, + MarkdownDescription: helpers.NewAttributeDescription("Set NAT UDP session timeout, in minutes, Attribute conditional on `nat_ipv4` being equal to `true`").AddIntegerRangeDescription(1, 8947).AddDefaultValueDescription("1").String, Optional: true, Validators: []validator.Int64{ int64validator.Between(1, 8947), }, }, "nat_udp_timeout_variable": schema.StringAttribute{ - MarkdownDescription: helpers.NewAttributeDescription("Variable name").String, + MarkdownDescription: helpers.NewAttributeDescription("Variable name, Attribute conditional on `nat_ipv4` being equal to `true`").String, Optional: true, }, "nat_tcp_timeout": schema.Int64Attribute{ - MarkdownDescription: helpers.NewAttributeDescription("Set NAT TCP session timeout, in minutes").AddIntegerRangeDescription(1, 8947).AddDefaultValueDescription("60").String, + MarkdownDescription: helpers.NewAttributeDescription("Set NAT TCP session timeout, in minutes, Attribute conditional on `nat_ipv4` being equal to `true`").AddIntegerRangeDescription(1, 8947).AddDefaultValueDescription("60").String, Optional: true, Validators: []validator.Int64{ int64validator.Between(1, 8947), }, }, "nat_tcp_timeout_variable": schema.StringAttribute{ - MarkdownDescription: helpers.NewAttributeDescription("Variable name").String, + MarkdownDescription: helpers.NewAttributeDescription("Variable name, Attribute conditional on `nat_ipv4` being equal to `true`").String, Optional: true, }, "new_static_nats": schema.ListNestedAttribute{ - MarkdownDescription: helpers.NewAttributeDescription("static NAT").String, + MarkdownDescription: helpers.NewAttributeDescription("static NAT, Attribute conditional on `nat_ipv4` being equal to `true`").String, Optional: true, NestedObject: schema.NestedAttributeObject{ Attributes: map[string]schema.Attribute{ diff --git a/templates/guides/changelog.md.tmpl b/templates/guides/changelog.md.tmpl index 3805e503e..e7d230649 100644 --- a/templates/guides/changelog.md.tmpl +++ b/templates/guides/changelog.md.tmpl @@ -7,6 +7,10 @@ description: |- # Changelog +## 0.6.3 (Unreleased) + +- 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) + ## 0.6.2 - Fix issue causing changes to applied feature templates to fail, [link](https://github.com/CiscoDevNet/terraform-provider-sdwan/issues/417) From 7bc83a9d149d830e5784b22a599a77a37b2007e7 Mon Sep 17 00:00:00 2001 From: Rafal Chrabaszcz Date: Fri, 8 Aug 2025 10:43:21 +0200 Subject: [PATCH 2/3] add nat ipv6 exclusion --- CHANGELOG.md | 2 +- docs/guides/changelog.md | 23 +++++++++---------- ...port_wan_vpn_interface_ethernet_feature.md | 10 ++++---- .../transport_wan_vpn_interface_ethernet.yaml | 12 ++++++++++ ...port_wan_vpn_interface_ethernet_feature.go | 6 ++--- ...port_wan_vpn_interface_ethernet_feature.go | 6 ++--- templates/guides/changelog.md.tmpl | 23 +++++++++---------- 7 files changed, 46 insertions(+), 36 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 38bb711f8..0ce8571f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ ## 0.6.3 (unreleased) -- 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) +- Fix issue, where NAT IPv4 and IPv6 is always configured on `sdwan_transport_wan_vpn_interface_ethernet_feature`, [link](https://github.com/CiscoDevNet/terraform-provider-sdwan/issues/485) - Add missing options under `unsupported_features` attribute of `sdwan_configuration_group`, [link](https://github.com/CiscoDevNet/terraform-provider-sdwan/issues/478) ## 0.6.2 diff --git a/docs/guides/changelog.md b/docs/guides/changelog.md index fc32e64b4..4d977e2ea 100644 --- a/docs/guides/changelog.md +++ b/docs/guides/changelog.md @@ -1,18 +1,17 @@ ---- -subcategory: "Guides" -page_title: "Changelog" -description: |- - Changelog ---- - -# Changelog - +--- +subcategory: "Guides" +page_title: "Changelog" +description: |- + Changelog +--- + +# Changelog + ## 0.6.3 (unreleased) -- 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) +- Fix issue, where NAT IPv4 and IPv6 is always configured on `sdwan_transport_wan_vpn_interface_ethernet_feature`, [link](https://github.com/CiscoDevNet/terraform-provider-sdwan/issues/485) - Add missing options under `unsupported_features` attribute of `sdwan_configuration_group`, [link](https://github.com/CiscoDevNet/terraform-provider-sdwan/issues/478) - ## 0.6.2 - Fix issue causing changes to applied feature templates to fail, [link](https://github.com/CiscoDevNet/terraform-provider-sdwan/issues/417) @@ -453,4 +452,4 @@ description: |- ## 0.1.0 (July 23, 2021) - Initial Release - + diff --git a/docs/resources/transport_wan_vpn_interface_ethernet_feature.md b/docs/resources/transport_wan_vpn_interface_ethernet_feature.md index f053600eb..746a5ff76 100644 --- a/docs/resources/transport_wan_vpn_interface_ethernet_feature.md +++ b/docs/resources/transport_wan_vpn_interface_ethernet_feature.md @@ -228,9 +228,9 @@ resource "sdwan_transport_wan_vpn_interface_ethernet_feature" "example" { - `media_type` (String) Media type - Choices: `auto-select`, `rj45`, `sfp` - `media_type_variable` (String) Variable name -- `nat64` (Boolean) NAT64 on this interface +- `nat64` (Boolean) NAT64 on this interface, Attribute conditional on `nat_ipv6` being equal to `true` - Default value: `false` -- `nat66` (Boolean) NAT66 on this interface +- `nat66` (Boolean) NAT66 on this interface, Attribute conditional on `nat_ipv6` being equal to `true` - Default value: `false` - `nat_ipv4` (Boolean) enable Network Address Translation on this interface - Default value: `false` @@ -261,8 +261,8 @@ resource "sdwan_transport_wan_vpn_interface_ethernet_feature" "example" { - `nat_udp_timeout` (Number) Set NAT UDP session timeout, in minutes, Attribute conditional on `nat_ipv4` being equal to `true` - Range: `1`-`8947` - Default value: `1` -- `nat_udp_timeout_variable` (String) Variable name -- `new_static_nats` (Attributes List) static NAT (see [below for nested schema](#nestedatt--new_static_nats)) +- `nat_udp_timeout_variable` (String) Variable name, Attribute conditional on `nat_ipv4` being equal to `true` +- `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)) - `per_tunnel_qos` (Boolean) Per-tunnel Qos, Attribute conditional on `tunnel_interface` being equal to `true` - Default value: `false` - `per_tunnel_qos_variable` (String) Variable name, Attribute conditional on `tunnel_interface` being equal to `true` @@ -304,7 +304,7 @@ resource "sdwan_transport_wan_vpn_interface_ethernet_feature" "example" { - `speed` (String) Set interface speed - Choices: `10`, `100`, `1000`, `2500`, `10000` - `speed_variable` (String) Variable name -- `static_nat66` (Attributes List) static NAT66 (see [below for nested schema](#nestedatt--static_nat66)) +- `static_nat66` (Attributes List) static NAT66, Attribute conditional on `nat_ipv6` being equal to `true` (see [below for nested schema](#nestedatt--static_nat66)) - `tcp_mss` (Number) TCP MSS on SYN packets, in bytes - Range: `500`-`1460` - `tcp_mss_variable` (String) Variable name diff --git a/gen/definitions/profile_parcels/transport_wan_vpn_interface_ethernet.yaml b/gen/definitions/profile_parcels/transport_wan_vpn_interface_ethernet.yaml index cd74e4b4e..832294286 100644 --- a/gen/definitions/profile_parcels/transport_wan_vpn_interface_ethernet.yaml +++ b/gen/definitions/profile_parcels/transport_wan_vpn_interface_ethernet.yaml @@ -532,13 +532,25 @@ attributes: data_path: [natAttributesIpv6] exclude_null: true example: false + conditional_attribute: + name: nat_ipv6 + value: true + type: Bool - model_name: nat66 data_path: [natAttributesIpv6] exclude_null: true example: true + conditional_attribute: + name: nat_ipv6 + value: true + type: Bool - model_name: staticNat66 data_path: [natAttributesIpv6] exclude_null: true + conditional_attribute: + name: nat_ipv6 + value: true + type: Bool attributes: - model_name: sourcePrefix id: true diff --git a/internal/provider/model_sdwan_transport_wan_vpn_interface_ethernet_feature.go b/internal/provider/model_sdwan_transport_wan_vpn_interface_ethernet_feature.go index a9039a821..de19d226d 100644 --- a/internal/provider/model_sdwan_transport_wan_vpn_interface_ethernet_feature.go +++ b/internal/provider/model_sdwan_transport_wan_vpn_interface_ethernet_feature.go @@ -1478,18 +1478,18 @@ func (data TransportWANVPNInterfaceEthernet) toBody(ctx context.Context) string } } if !data.Nat64.IsNull() { - if true { + if true && data.NatIpv6.ValueBool() == true { body, _ = sjson.Set(body, path+"natAttributesIpv6.nat64.optionType", "global") body, _ = sjson.Set(body, path+"natAttributesIpv6.nat64.value", data.Nat64.ValueBool()) } } if !data.Nat66.IsNull() { - if true { + if true && data.NatIpv6.ValueBool() == true { body, _ = sjson.Set(body, path+"natAttributesIpv6.nat66.optionType", "global") body, _ = sjson.Set(body, path+"natAttributesIpv6.nat66.value", data.Nat66.ValueBool()) } } - if true { + if true && data.NatIpv6.ValueBool() == true { for _, item := range data.StaticNat66 { itemBody := "" diff --git a/internal/provider/resource_sdwan_transport_wan_vpn_interface_ethernet_feature.go b/internal/provider/resource_sdwan_transport_wan_vpn_interface_ethernet_feature.go index ac4b69dcf..b02429c1b 100644 --- a/internal/provider/resource_sdwan_transport_wan_vpn_interface_ethernet_feature.go +++ b/internal/provider/resource_sdwan_transport_wan_vpn_interface_ethernet_feature.go @@ -818,15 +818,15 @@ func (r *TransportWANVPNInterfaceEthernetProfileParcelResource) Schema(ctx conte Optional: true, }, "nat64": schema.BoolAttribute{ - MarkdownDescription: helpers.NewAttributeDescription("NAT64 on this interface").AddDefaultValueDescription("false").String, + MarkdownDescription: helpers.NewAttributeDescription("NAT64 on this interface, Attribute conditional on `nat_ipv6` being equal to `true`").AddDefaultValueDescription("false").String, Optional: true, }, "nat66": schema.BoolAttribute{ - MarkdownDescription: helpers.NewAttributeDescription("NAT66 on this interface").AddDefaultValueDescription("false").String, + MarkdownDescription: helpers.NewAttributeDescription("NAT66 on this interface, Attribute conditional on `nat_ipv6` being equal to `true`").AddDefaultValueDescription("false").String, Optional: true, }, "static_nat66": schema.ListNestedAttribute{ - MarkdownDescription: helpers.NewAttributeDescription("static NAT66").String, + MarkdownDescription: helpers.NewAttributeDescription("static NAT66, Attribute conditional on `nat_ipv6` being equal to `true`").String, Optional: true, NestedObject: schema.NestedAttributeObject{ Attributes: map[string]schema.Attribute{ diff --git a/templates/guides/changelog.md.tmpl b/templates/guides/changelog.md.tmpl index fc32e64b4..4d977e2ea 100644 --- a/templates/guides/changelog.md.tmpl +++ b/templates/guides/changelog.md.tmpl @@ -1,18 +1,17 @@ ---- -subcategory: "Guides" -page_title: "Changelog" -description: |- - Changelog ---- - -# Changelog - +--- +subcategory: "Guides" +page_title: "Changelog" +description: |- + Changelog +--- + +# Changelog + ## 0.6.3 (unreleased) -- 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) +- Fix issue, where NAT IPv4 and IPv6 is always configured on `sdwan_transport_wan_vpn_interface_ethernet_feature`, [link](https://github.com/CiscoDevNet/terraform-provider-sdwan/issues/485) - Add missing options under `unsupported_features` attribute of `sdwan_configuration_group`, [link](https://github.com/CiscoDevNet/terraform-provider-sdwan/issues/478) - ## 0.6.2 - Fix issue causing changes to applied feature templates to fail, [link](https://github.com/CiscoDevNet/terraform-provider-sdwan/issues/417) @@ -453,4 +452,4 @@ description: |- ## 0.1.0 (July 23, 2021) - Initial Release - + From d5c4ee1e267a04f5735f7c7ec457fccec71d66cb Mon Sep 17 00:00:00 2001 From: Rafal Chrabaszcz Date: Fri, 8 Aug 2025 15:43:20 +0200 Subject: [PATCH 3/3] go generate --- docs/guides/changelog.md | 22 +++++++++---------- ...port_wan_vpn_interface_ethernet_feature.go | 12 ++++++++++ templates/guides/changelog.md.tmpl | 22 +++++++++---------- 3 files changed, 34 insertions(+), 22 deletions(-) diff --git a/docs/guides/changelog.md b/docs/guides/changelog.md index ab8ad4cea..b2461f25e 100644 --- a/docs/guides/changelog.md +++ b/docs/guides/changelog.md @@ -1,19 +1,19 @@ ---- -subcategory: "Guides" -page_title: "Changelog" -description: |- - Changelog ---- - -# Changelog - +--- +subcategory: "Guides" +page_title: "Changelog" +description: |- + Changelog +--- + +# Changelog + ## 0.6.3 (unreleased) -- Fix issue, where NAT IPv4 and IPv6 is always configured on `sdwan_transport_wan_vpn_interface_ethernet_feature`, [link](https://github.com/CiscoDevNet/terraform-provider-sdwan/issues/485) - BREAKING CHANGE: Rename `tls_ssl_profile_version` attribute of `sdwan_tls_ssl_decryption_policy_definition` resource to `tls_ssl_profile_policy_version` - BREAKING CHANGE: Rename `sla_class_list` attribute of `sdwan_application_aware_routing_policy_definition` resource to `sla_class_list_id` - BREAKING CHANGE: Rename `preferred_color_group_list` attribute of `sdwan_application_aware_routing_policy_definition` resource to `preferred_color_group_list_id` - BREAKING CHANGE: Rename `preferred_color_group_list` attribute of `sdwan_traffic_data_policy_definition` resource to `preferred_color_group_list_id` +- Fix issue, where NAT IPv4 and IPv6 is always configured on `sdwan_transport_wan_vpn_interface_ethernet_feature`, [link](https://github.com/CiscoDevNet/terraform-provider-sdwan/issues/485) - Add missing options under `unsupported_features` attribute of `sdwan_configuration_group`, [link](https://github.com/CiscoDevNet/terraform-provider-sdwan/issues/478) - Add `sdwan_policy_group` resource and data source @@ -457,4 +457,4 @@ description: |- ## 0.1.0 (July 23, 2021) - Initial Release - + diff --git a/internal/provider/model_sdwan_transport_wan_vpn_interface_ethernet_feature.go b/internal/provider/model_sdwan_transport_wan_vpn_interface_ethernet_feature.go index afe774454..3be4db968 100644 --- a/internal/provider/model_sdwan_transport_wan_vpn_interface_ethernet_feature.go +++ b/internal/provider/model_sdwan_transport_wan_vpn_interface_ethernet_feature.go @@ -2677,6 +2677,7 @@ func (data *TransportWANVPNInterfaceEthernet) fromBody(ctx context.Context, res } else if t.String() == "global" { data.NatType = types.StringValue(va.String()) } + data.NatIpv4 = types.BoolValue(true) } data.NatRangeStart = types.StringNull() data.NatRangeStartVariable = types.StringNull() @@ -2687,6 +2688,7 @@ func (data *TransportWANVPNInterfaceEthernet) fromBody(ctx context.Context, res } else if t.String() == "global" { data.NatRangeStart = types.StringValue(va.String()) } + data.NatIpv4 = types.BoolValue(true) } data.NatRangeEnd = types.StringNull() data.NatRangeEndVariable = types.StringNull() @@ -2697,6 +2699,7 @@ func (data *TransportWANVPNInterfaceEthernet) fromBody(ctx context.Context, res } else if t.String() == "global" { data.NatRangeEnd = types.StringValue(va.String()) } + data.NatIpv4 = types.BoolValue(true) } data.NatPrefixLength = types.Int64Null() data.NatPrefixLengthVariable = types.StringNull() @@ -2707,6 +2710,7 @@ func (data *TransportWANVPNInterfaceEthernet) fromBody(ctx context.Context, res } else if t.String() == "global" { data.NatPrefixLength = types.Int64Value(va.Int()) } + data.NatIpv4 = types.BoolValue(true) } data.NatOverload = types.BoolNull() data.NatOverloadVariable = types.StringNull() @@ -2717,6 +2721,7 @@ func (data *TransportWANVPNInterfaceEthernet) fromBody(ctx context.Context, res } else if t.String() == "global" { data.NatOverload = types.BoolValue(va.Bool()) } + data.NatIpv4 = types.BoolValue(true) } data.NatLoopback = types.StringNull() data.NatLoopbackVariable = types.StringNull() @@ -2727,6 +2732,7 @@ func (data *TransportWANVPNInterfaceEthernet) fromBody(ctx context.Context, res } else if t.String() == "global" { data.NatLoopback = types.StringValue(va.String()) } + data.NatIpv4 = types.BoolValue(true) } data.NatUdpTimeout = types.Int64Null() data.NatUdpTimeoutVariable = types.StringNull() @@ -2737,6 +2743,7 @@ func (data *TransportWANVPNInterfaceEthernet) fromBody(ctx context.Context, res } else if t.String() == "global" { data.NatUdpTimeout = types.Int64Value(va.Int()) } + data.NatIpv4 = types.BoolValue(true) } data.NatTcpTimeout = types.Int64Null() data.NatTcpTimeoutVariable = types.StringNull() @@ -2747,6 +2754,7 @@ func (data *TransportWANVPNInterfaceEthernet) fromBody(ctx context.Context, res } else if t.String() == "global" { data.NatTcpTimeout = types.Int64Value(va.Int()) } + data.NatIpv4 = types.BoolValue(true) } if value := res.Get(path + "natAttributesIpv4.newStaticNat"); value.Exists() && len(value.Array()) > 0 { data.NewStaticNats = make([]TransportWANVPNInterfaceEthernetNewStaticNats, 0) @@ -2793,6 +2801,7 @@ func (data *TransportWANVPNInterfaceEthernet) fromBody(ctx context.Context, res data.NewStaticNats = append(data.NewStaticNats, item) return true }) + data.NatIpv4 = types.BoolValue(true) } data.NatIpv6 = types.BoolNull() data.NatIpv6Variable = types.StringNull() @@ -2811,6 +2820,7 @@ func (data *TransportWANVPNInterfaceEthernet) fromBody(ctx context.Context, res if t.String() == "global" { data.Nat64 = types.BoolValue(va.Bool()) } + data.NatIpv6 = types.BoolValue(true) } data.Nat66 = types.BoolNull() @@ -2819,6 +2829,7 @@ func (data *TransportWANVPNInterfaceEthernet) fromBody(ctx context.Context, res if t.String() == "global" { data.Nat66 = types.BoolValue(va.Bool()) } + data.NatIpv6 = types.BoolValue(true) } if value := res.Get(path + "natAttributesIpv6.staticNat66"); value.Exists() && len(value.Array()) > 0 { data.StaticNat66 = make([]TransportWANVPNInterfaceEthernetStaticNat66, 0) @@ -2857,6 +2868,7 @@ func (data *TransportWANVPNInterfaceEthernet) fromBody(ctx context.Context, res data.StaticNat66 = append(data.StaticNat66, item) return true }) + data.NatIpv6 = types.BoolValue(true) } data.QosAdaptive = types.BoolNull() diff --git a/templates/guides/changelog.md.tmpl b/templates/guides/changelog.md.tmpl index ab8ad4cea..b2461f25e 100644 --- a/templates/guides/changelog.md.tmpl +++ b/templates/guides/changelog.md.tmpl @@ -1,19 +1,19 @@ ---- -subcategory: "Guides" -page_title: "Changelog" -description: |- - Changelog ---- - -# Changelog - +--- +subcategory: "Guides" +page_title: "Changelog" +description: |- + Changelog +--- + +# Changelog + ## 0.6.3 (unreleased) -- Fix issue, where NAT IPv4 and IPv6 is always configured on `sdwan_transport_wan_vpn_interface_ethernet_feature`, [link](https://github.com/CiscoDevNet/terraform-provider-sdwan/issues/485) - BREAKING CHANGE: Rename `tls_ssl_profile_version` attribute of `sdwan_tls_ssl_decryption_policy_definition` resource to `tls_ssl_profile_policy_version` - BREAKING CHANGE: Rename `sla_class_list` attribute of `sdwan_application_aware_routing_policy_definition` resource to `sla_class_list_id` - BREAKING CHANGE: Rename `preferred_color_group_list` attribute of `sdwan_application_aware_routing_policy_definition` resource to `preferred_color_group_list_id` - BREAKING CHANGE: Rename `preferred_color_group_list` attribute of `sdwan_traffic_data_policy_definition` resource to `preferred_color_group_list_id` +- Fix issue, where NAT IPv4 and IPv6 is always configured on `sdwan_transport_wan_vpn_interface_ethernet_feature`, [link](https://github.com/CiscoDevNet/terraform-provider-sdwan/issues/485) - Add missing options under `unsupported_features` attribute of `sdwan_configuration_group`, [link](https://github.com/CiscoDevNet/terraform-provider-sdwan/issues/478) - Add `sdwan_policy_group` resource and data source @@ -457,4 +457,4 @@ description: |- ## 0.1.0 (July 23, 2021) - Initial Release - +