Skip to content

Resolve Issue #426 #464

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Aug 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 3 additions & 14 deletions docs/resources/service_lan_vpn_interface_ethernet_feature.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,9 @@ resource "sdwan_service_lan_vpn_interface_ethernet_feature" "example" {
ipv4_nat_range_end = "4.5.6.7"
ipv4_nat_prefix_length = 1
ipv4_nat_overload = true
ipv4_nat_loopback = "123"
ipv4_nat_udp_timeout = 123
ipv4_nat_tcp_timeout = 123
static_nats = [
{
source_ip = "1.2.3.4"
translate_ip = "2.3.4.5"
direction = "inside"
source_vpn = 0
}
]
ipv6_nat = true
nat64 = false
acl_shaping_rate = 12
ipv6_nat = true
nat64 = false
acl_shaping_rate = 12
ipv6_vrrps = [
{
group_id = 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,9 @@ resource "sdwan_service_lan_vpn_interface_ethernet_feature" "example" {
ipv4_nat_range_end = "4.5.6.7"
ipv4_nat_prefix_length = 1
ipv4_nat_overload = true
ipv4_nat_loopback = "123"
ipv4_nat_udp_timeout = 123
ipv4_nat_tcp_timeout = 123
static_nats = [
{
source_ip = "1.2.3.4"
translate_ip = "2.3.4.5"
direction = "inside"
source_vpn = 0
}
]
ipv6_nat = true
nat64 = false
acl_shaping_rate = 12
ipv6_nat = true
nat64 = false
acl_shaping_rate = 12
ipv6_vrrps = [
{
group_id = 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,34 +109,58 @@ attributes:
- model_name: rangeStart
tf_name: ipv4_nat_range_start
data_path: [natAttributesIpv4, natPool]
exclude_null: true
# conditional_attribute:
# name: Ipv4NatType
# value: pool
example: 1.2.3.4
- model_name: rangeEnd
tf_name: ipv4_nat_range_end
data_path: [natAttributesIpv4, natPool]
exclude_null: true
# conditional_attribute:
# name: Ipv4NatType
# value: pool
example: 4.5.6.7
- model_name: prefixLength
tf_name: ipv4_nat_prefix_length
data_path: [natAttributesIpv4, natPool]
exclude_null: true
# conditional_attribute:
# name: Ipv4NatType
# value: pool
example: 1
- model_name: overload
tf_name: ipv4_nat_overload
data_path: [natAttributesIpv4, natPool]
exclude_null: true
# conditional_attribute:
# name: Ipv4NatType
# value: pool
example: true
- model_name: natLookback
tf_name: ipv4_nat_loopback
data_path: [natAttributesIpv4]
exclude_test: true
exclude_null: true
# conditional_attribute:
# name: Ipv4NatType
# value: loopback
example: 123
- model_name: udpTimeout
tf_name: ipv4_nat_udp_timeout
data_path: [natAttributesIpv4]
exclude_test: true
example: 123
- model_name: tcpTimeout
tf_name: ipv4_nat_tcp_timeout
data_path: [natAttributesIpv4]
exclude_test: true
example: 123
- model_name: newStaticNat
tf_name: static_nats
data_path: [natAttributesIpv4]
exclude_test: true
attributes:
- model_name: sourceIp
id: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"net/url"

"github.com/CiscoDevNet/terraform-provider-sdwan/internal/provider/helpers"
"github.com/hashicorp/go-version"
"github.com/hashicorp/terraform-plugin-framework/datasource"
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
"github.com/hashicorp/terraform-plugin-framework/types"
Expand Down Expand Up @@ -961,7 +962,6 @@ func (d *ServiceLANVPNProfileParcelDataSource) Configure(_ context.Context, req

// End of section. //template:end model

// Section below is generated&owned by "gen/generator.go". //template:begin read
func (d *ServiceLANVPNProfileParcelDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) {
var config ServiceLANVPN

Expand All @@ -974,18 +974,19 @@ func (d *ServiceLANVPNProfileParcelDataSource) Read(ctx context.Context, req dat

tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", config.Id.String()))

// Get Manager Version
currentVersion := version.Must(version.NewVersion(d.client.ManagerVersion))

res, err := d.client.Get(config.getPath() + "/" + url.QueryEscape(config.Id.ValueString()))
if err != nil {
resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object, got error: %s", err))
return
}

config.fromBody(ctx, res)
config.fromBody(ctx, res, currentVersion)

tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", config.Name.ValueString()))

diags = resp.State.Set(ctx, &config)
resp.Diagnostics.Append(diags...)
}

// End of section. //template:end read
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"net/url"

"github.com/CiscoDevNet/terraform-provider-sdwan/internal/provider/helpers"
"github.com/hashicorp/go-version"
"github.com/hashicorp/terraform-plugin-framework/datasource"
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
"github.com/hashicorp/terraform-plugin-framework/types"
Expand Down Expand Up @@ -710,7 +711,6 @@ func (d *ServiceLANVPNInterfaceEthernetProfileParcelDataSource) Configure(_ cont

// End of section. //template:end model

// Section below is generated&owned by "gen/generator.go". //template:begin read
func (d *ServiceLANVPNInterfaceEthernetProfileParcelDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) {
var config ServiceLANVPNInterfaceEthernet

Expand All @@ -723,18 +723,19 @@ func (d *ServiceLANVPNInterfaceEthernetProfileParcelDataSource) Read(ctx context

tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", config.Id.String()))

// Get Manager Version
currentVersion := version.Must(version.NewVersion(d.client.ManagerVersion))

res, err := d.client.Get(config.getPath() + "/" + url.QueryEscape(config.Id.ValueString()))
if err != nil {
resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object, got error: %s", err))
return
}

config.fromBody(ctx, res)
config.fromBody(ctx, res, currentVersion)

tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", config.Name.ValueString()))

diags = resp.State.Set(ctx, &config)
resp.Diagnostics.Append(diags...)
}

// End of section. //template:end read
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,6 @@ func TestAccDataSourceSdwanServiceLANVPNInterfaceEthernetProfileParcel(t *testin
checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_service_lan_vpn_interface_ethernet_feature.test", "ipv4_nat_range_end", "4.5.6.7"))
checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_service_lan_vpn_interface_ethernet_feature.test", "ipv4_nat_prefix_length", "1"))
checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_service_lan_vpn_interface_ethernet_feature.test", "ipv4_nat_overload", "true"))
checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_service_lan_vpn_interface_ethernet_feature.test", "ipv4_nat_loopback", "123"))
checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_service_lan_vpn_interface_ethernet_feature.test", "ipv4_nat_udp_timeout", "123"))
checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_service_lan_vpn_interface_ethernet_feature.test", "ipv4_nat_tcp_timeout", "123"))
checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_service_lan_vpn_interface_ethernet_feature.test", "static_nats.0.source_ip", "1.2.3.4"))
checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_service_lan_vpn_interface_ethernet_feature.test", "static_nats.0.translate_ip", "2.3.4.5"))
checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_service_lan_vpn_interface_ethernet_feature.test", "static_nats.0.direction", "inside"))
checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_service_lan_vpn_interface_ethernet_feature.test", "static_nats.0.source_vpn", "0"))
checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_service_lan_vpn_interface_ethernet_feature.test", "ipv6_nat", "true"))
checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_service_lan_vpn_interface_ethernet_feature.test", "nat64", "false"))
checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_service_lan_vpn_interface_ethernet_feature.test", "acl_shaping_rate", "12"))
Expand Down Expand Up @@ -167,15 +160,6 @@ func testAccDataSourceSdwanServiceLANVPNInterfaceEthernetProfileParcelConfig() s
config += ` ipv4_nat_range_end = "4.5.6.7"` + "\n"
config += ` ipv4_nat_prefix_length = 1` + "\n"
config += ` ipv4_nat_overload = true` + "\n"
config += ` ipv4_nat_loopback = "123"` + "\n"
config += ` ipv4_nat_udp_timeout = 123` + "\n"
config += ` ipv4_nat_tcp_timeout = 123` + "\n"
config += ` static_nats = [{` + "\n"
config += ` source_ip = "1.2.3.4"` + "\n"
config += ` translate_ip = "2.3.4.5"` + "\n"
config += ` direction = "inside"` + "\n"
config += ` source_vpn = 0` + "\n"
config += ` }]` + "\n"
config += ` ipv6_nat = true` + "\n"
config += ` nat64 = false` + "\n"
config += ` acl_shaping_rate = 12` + "\n"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"net/url"

"github.com/CiscoDevNet/terraform-provider-sdwan/internal/provider/helpers"
"github.com/hashicorp/go-version"
"github.com/hashicorp/terraform-plugin-framework/datasource"
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
"github.com/hashicorp/terraform-plugin-framework/types"
Expand Down Expand Up @@ -1007,7 +1008,6 @@ func (d *TransportWANVPNInterfaceEthernetProfileParcelDataSource) Configure(_ co

// End of section. //template:end model

// Section below is generated&owned by "gen/generator.go". //template:begin read
func (d *TransportWANVPNInterfaceEthernetProfileParcelDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) {
var config TransportWANVPNInterfaceEthernet

Expand All @@ -1020,18 +1020,19 @@ func (d *TransportWANVPNInterfaceEthernetProfileParcelDataSource) Read(ctx conte

tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", config.Id.String()))

// Get Manager Version
currentVersion := version.Must(version.NewVersion(d.client.ManagerVersion))

res, err := d.client.Get(config.getPath() + "/" + url.QueryEscape(config.Id.ValueString()))
if err != nil {
resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object, got error: %s", err))
return
}

config.fromBody(ctx, res)
config.fromBody(ctx, res, currentVersion)

tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", config.Name.ValueString()))

diags = resp.State.Set(ctx, &config)
resp.Diagnostics.Append(diags...)
}

// End of section. //template:end read
Loading