diff --git a/CHANGELOG.md b/CHANGELOG.md index f0ad041c0..59833816d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ - 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 - Adds `enhanced_app_aware_routing` support to the `sdwan_cisco_system_feature_template` resource and data source +- Add `gateway` attribute for `ipv4_static_routes` and `ipv6_static_routes` in `sdwan_service_lan_vpn_feature` resource ## 0.6.2 diff --git a/docs/data-sources/service_lan_vpn_feature.md b/docs/data-sources/service_lan_vpn_feature.md index 25cdf30f9..edc980eec 100644 --- a/docs/data-sources/service_lan_vpn_feature.md +++ b/docs/data-sources/service_lan_vpn_feature.md @@ -179,7 +179,8 @@ Read-Only: Read-Only: -- `gateway_dhcp` (Boolean) IPv4 Route Gateway DHCP +- `dhcp` (Boolean) IPv4 Route Gateway DHCP +- `gateway` (String) Gateway type - `network_address` (String) IP Address - `network_address_variable` (String) Variable name - `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: Read-Only: +- `gateway` (String) Gateway type - `nat` (String) IPv6 Nat - `nat_variable` (String) Variable name - `next_hops` (Attributes List) IPv6 Route Gateway Next Hop (see [below for nested schema](#nestedatt--ipv6_static_routes--next_hops)) diff --git a/docs/guides/changelog.md b/docs/guides/changelog.md index 3aed93508..70aca3d71 100644 --- a/docs/guides/changelog.md +++ b/docs/guides/changelog.md @@ -16,6 +16,7 @@ description: |- - 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 - Adds `enhanced_app_aware_routing` support to the `sdwan_cisco_system_feature_template` resource and data source +- Add `gateway` attribute for `ipv4_static_routes` and `ipv6_static_routes` in `sdwan_service_lan_vpn_feature` resource ## 0.6.2 diff --git a/docs/resources/service_lan_vpn_feature.md b/docs/resources/service_lan_vpn_feature.md index b63845209..6c6ed3f7a 100644 --- a/docs/resources/service_lan_vpn_feature.md +++ b/docs/resources/service_lan_vpn_feature.md @@ -38,6 +38,7 @@ resource "sdwan_service_lan_vpn_feature" "example" { { network_address = "1.2.3.4" subnet_mask = "0.0.0.0" + gateway = "nextHop" next_hops = [ { address = "1.2.3.4" @@ -48,7 +49,8 @@ resource "sdwan_service_lan_vpn_feature" "example" { ] ipv6_static_routes = [ { - prefix = "2001:0:0:1::0/12" + prefix = "2001:0:0:1::0/12" + gateway = "nextHop" next_hops = [ { address = "2001:0:0:1::0" @@ -323,16 +325,18 @@ Optional: Optional: -- `gateway_dhcp` (Boolean) IPv4 Route Gateway DHCP +- `dhcp` (Boolean) IPv4 Route Gateway DHCP, Attribute conditional on `gateway` being equal to `dhcp` +- `gateway` (String) Gateway type + - Choices: `nextHop`, `null0`, `vpn`, `dhcp` - `network_address` (String) IP Address - `network_address_variable` (String) Variable name -- `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)) -- `next_hops` (Attributes List) IPv4 Route Gateway Next Hop (see [below for nested schema](#nestedatt--ipv4_static_routes--next_hops)) -- `null0` (Boolean) IPv4 Route Gateway Next Hop +- `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)) +- `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)) +- `null0` (Boolean) IPv4 Route Gateway Next Hop, Attribute conditional on `gateway` being equal to `null0` - `subnet_mask` (String) Subnet Mask - 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` - `subnet_mask_variable` (String) Variable name -- `vpn` (Boolean) IPv4 Route Gateway VPN +- `vpn` (Boolean) IPv4 Route Gateway VPN, Attribute conditional on `gateway` being equal to `vpn` ### Nested Schema for `ipv4_static_routes.next_hop_with_trackers` @@ -383,11 +387,13 @@ Optional: Optional: -- `nat` (String) IPv6 Nat +- `gateway` (String) Gateway type + - Choices: `nextHop`, `null0`, `nat` +- `nat` (String) IPv6 Nat, Attribute conditional on `gateway` being equal to `nat` - Choices: `NAT64`, `NAT66` -- `nat_variable` (String) Variable name -- `next_hops` (Attributes List) IPv6 Route Gateway Next Hop (see [below for nested schema](#nestedatt--ipv6_static_routes--next_hops)) -- `null0` (Boolean) IPv6 Route Gateway Next Hop +- `nat_variable` (String) Variable name, Attribute conditional on `gateway` being equal to `nat` +- `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)) +- `null0` (Boolean) IPv6 Route Gateway Next Hop, Attribute conditional on `gateway` being equal to `null0` - `prefix` (String) Prefix - `prefix_variable` (String) Variable name diff --git a/examples/resources/sdwan_service_lan_vpn_feature/resource.tf b/examples/resources/sdwan_service_lan_vpn_feature/resource.tf index fe314d2f6..a8e13bab2 100644 --- a/examples/resources/sdwan_service_lan_vpn_feature/resource.tf +++ b/examples/resources/sdwan_service_lan_vpn_feature/resource.tf @@ -21,6 +21,7 @@ resource "sdwan_service_lan_vpn_feature" "example" { { network_address = "1.2.3.4" subnet_mask = "0.0.0.0" + gateway = "nextHop" next_hops = [ { address = "1.2.3.4" @@ -31,7 +32,8 @@ resource "sdwan_service_lan_vpn_feature" "example" { ] ipv6_static_routes = [ { - prefix = "2001:0:0:1::0/12" + prefix = "2001:0:0:1::0/12" + gateway = "nextHop" next_hops = [ { address = "2001:0:0:1::0" diff --git a/gen/definitions/profile_parcels/service_lan_vpn.yaml b/gen/definitions/profile_parcels/service_lan_vpn.yaml index 0206f31b6..415791395 100644 --- a/gen/definitions/profile_parcels/service_lan_vpn.yaml +++ b/gen/definitions/profile_parcels/service_lan_vpn.yaml @@ -114,9 +114,18 @@ attributes: - model_name: subnetMask data_path: [prefix] example: 0.0.0.0 + - tf_name: gateway + type: String + tf_only: true + description: Gateway type + enum_values: [nextHop, null0, vpn, dhcp] + example: nextHop - model_name: nextHop tf_name: next_hops data_path: [oneOfIpRoute, nextHopContainer] + conditional_attribute: + name: gateway + value: nextHop attributes: - model_name: address id: true @@ -128,6 +137,9 @@ attributes: tf_name: next_hop_with_trackers data_path: [oneOfIpRoute, nextHopContainer] exclude_test: true + conditional_attribute: + name: gateway + value: nextHop attributes: - model_name: address example: 1.2.3.4 @@ -142,24 +154,41 @@ attributes: data_path: [oneOfIpRoute] exclude_test: true example: false + conditional_attribute: + name: gateway + value: null0 - model_name: dhcp - tf_name: gateway_dhcp data_path: [oneOfIpRoute] exclude_test: true example: false + conditional_attribute: + name: gateway + value: dhcp - model_name: vpn data_path: [oneOfIpRoute] exclude_test: true example: false + conditional_attribute: + name: gateway + value: vpn - model_name: ipv6Route tf_name: ipv6_static_routes attributes: - model_name: prefix id: true example: 2001:0:0:1::0/12 + - tf_name: gateway + type: String + tf_only: true + description: Gateway type + enum_values: [nextHop, null0, nat] + example: nextHop - model_name: nextHop tf_name: next_hops data_path: [oneOfIpRoute, nextHopContainer] + conditional_attribute: + name: gateway + value: nextHop attributes: - model_name: address id: true @@ -170,11 +199,16 @@ attributes: - model_name: null0 data_path: [oneOfIpRoute] exclude_test: true - example: false + conditional_attribute: + name: gateway + value: null0 - model_name: nat data_path: [oneOfIpRoute] exclude_test: true example: NAT64 + conditional_attribute: + name: gateway + value: nat - model_name: service tf_name: services attributes: @@ -344,7 +378,7 @@ attributes: exclude_test: true example: 1b270f6d-479b-47e3-ab0b-51bc6811a303 - model_name: routeLeakBetweenServices - tf_name: route_leak_from_other_services + tf_name: route_leak_from_other_services exclude_test: true attributes: - model_name: sourceVpn @@ -374,7 +408,7 @@ attributes: - model_name: rt tf_name: route_target id: true - example: 1.1.1.3:200 + example: 1.1.1.3:200 - model_name: exportRtList tf_name: ipv4_export_route_targets data_path: [mplsVpnIpv4RouteTarget] diff --git a/gen/definitions/profile_parcels/transport_wan_vpn.yaml b/gen/definitions/profile_parcels/transport_wan_vpn.yaml index f2de2a006..3af5ddea0 100644 --- a/gen/definitions/profile_parcels/transport_wan_vpn.yaml +++ b/gen/definitions/profile_parcels/transport_wan_vpn.yaml @@ -104,7 +104,6 @@ attributes: - model_name: distance tf_name: administrative_distance example: 1 - - model_name: null0 data_path: [oneOfIpRoute] exclude_test: true @@ -112,7 +111,6 @@ attributes: name: gateway value: null0 example: true - - model_name: nat data_path: [oneOfIpRoute] exclude_test: true @@ -120,7 +118,6 @@ attributes: name: gateway value: nat example: NAT64 - - model_name: service tf_name: services attributes: diff --git a/internal/provider/data_source_sdwan_service_lan_vpn_feature.go b/internal/provider/data_source_sdwan_service_lan_vpn_feature.go index 05e49c955..6538a7959 100644 --- a/internal/provider/data_source_sdwan_service_lan_vpn_feature.go +++ b/internal/provider/data_source_sdwan_service_lan_vpn_feature.go @@ -298,6 +298,10 @@ func (d *ServiceLANVPNProfileParcelDataSource) Schema(ctx context.Context, req d MarkdownDescription: helpers.NewAttributeDescription("Variable name").String, Computed: true, }, + "gateway": schema.StringAttribute{ + MarkdownDescription: "Gateway type", + Computed: true, + }, "next_hops": schema.ListNestedAttribute{ MarkdownDescription: "IPv4 Route Gateway Next Hop", Computed: true, @@ -354,7 +358,7 @@ func (d *ServiceLANVPNProfileParcelDataSource) Schema(ctx context.Context, req d MarkdownDescription: "IPv4 Route Gateway Next Hop", Computed: true, }, - "gateway_dhcp": schema.BoolAttribute{ + "dhcp": schema.BoolAttribute{ MarkdownDescription: "IPv4 Route Gateway DHCP", Computed: true, }, @@ -378,6 +382,10 @@ func (d *ServiceLANVPNProfileParcelDataSource) Schema(ctx context.Context, req d MarkdownDescription: helpers.NewAttributeDescription("Variable name").String, Computed: true, }, + "gateway": schema.StringAttribute{ + MarkdownDescription: "Gateway type", + Computed: true, + }, "next_hops": schema.ListNestedAttribute{ MarkdownDescription: "IPv6 Route Gateway Next Hop", Computed: true, diff --git a/internal/provider/data_source_sdwan_service_lan_vpn_feature_test.go b/internal/provider/data_source_sdwan_service_lan_vpn_feature_test.go index 2a61ef770..e653866d9 100644 --- a/internal/provider/data_source_sdwan_service_lan_vpn_feature_test.go +++ b/internal/provider/data_source_sdwan_service_lan_vpn_feature_test.go @@ -131,6 +131,7 @@ func testAccDataSourceSdwanServiceLANVPNProfileParcelConfig() string { config += ` ipv4_static_routes = [{` + "\n" config += ` network_address = "1.2.3.4"` + "\n" config += ` subnet_mask = "0.0.0.0"` + "\n" + config += ` gateway = "nextHop"` + "\n" config += ` next_hops = [{` + "\n" config += ` address = "1.2.3.4"` + "\n" config += ` administrative_distance = 1` + "\n" @@ -138,6 +139,7 @@ func testAccDataSourceSdwanServiceLANVPNProfileParcelConfig() string { config += ` }]` + "\n" config += ` ipv6_static_routes = [{` + "\n" config += ` prefix = "2001:0:0:1::0/12"` + "\n" + config += ` gateway = "nextHop"` + "\n" config += ` next_hops = [{` + "\n" config += ` address = "2001:0:0:1::0"` + "\n" config += ` administrative_distance = 1` + "\n" diff --git a/internal/provider/model_sdwan_service_lan_vpn_feature.go b/internal/provider/model_sdwan_service_lan_vpn_feature.go index b611d59c3..51e14a3ef 100644 --- a/internal/provider/model_sdwan_service_lan_vpn_feature.go +++ b/internal/provider/model_sdwan_service_lan_vpn_feature.go @@ -109,16 +109,18 @@ type ServiceLANVPNIpv4StaticRoutes struct { NetworkAddressVariable types.String `tfsdk:"network_address_variable"` SubnetMask types.String `tfsdk:"subnet_mask"` SubnetMaskVariable types.String `tfsdk:"subnet_mask_variable"` + Gateway types.String `tfsdk:"gateway"` NextHops []ServiceLANVPNIpv4StaticRoutesNextHops `tfsdk:"next_hops"` NextHopWithTrackers []ServiceLANVPNIpv4StaticRoutesNextHopWithTrackers `tfsdk:"next_hop_with_trackers"` Null0 types.Bool `tfsdk:"null0"` - GatewayDhcp types.Bool `tfsdk:"gateway_dhcp"` + Dhcp types.Bool `tfsdk:"dhcp"` Vpn types.Bool `tfsdk:"vpn"` } type ServiceLANVPNIpv6StaticRoutes struct { Prefix types.String `tfsdk:"prefix"` PrefixVariable types.String `tfsdk:"prefix_variable"` + Gateway types.String `tfsdk:"gateway"` NextHops []ServiceLANVPNIpv6StaticRoutesNextHops `tfsdk:"next_hops"` Null0 types.Bool `tfsdk:"null0"` Nat types.String `tfsdk:"nat"` @@ -690,7 +692,7 @@ func (data ServiceLANVPN) toBody(ctx context.Context, currentVersion *version.Ve itemBody, _ = sjson.Set(itemBody, "prefix.subnetMask.value", item.SubnetMask.ValueString()) } } - if true { + if true && item.Gateway.ValueString() == "nextHop" { for _, childItem := range item.NextHops { itemChildBody := "" @@ -721,7 +723,7 @@ func (data ServiceLANVPN) toBody(ctx context.Context, currentVersion *version.Ve itemBody, _ = sjson.SetRaw(itemBody, "oneOfIpRoute.nextHopContainer.nextHop.-1", itemChildBody) } } - if true { + if true && item.Gateway.ValueString() == "nextHop" { for _, childItem := range item.NextHopWithTrackers { itemChildBody := "" @@ -759,19 +761,19 @@ func (data ServiceLANVPN) toBody(ctx context.Context, currentVersion *version.Ve } } if !item.Null0.IsNull() { - if true { + if true && item.Gateway.ValueString() == "null0" { itemBody, _ = sjson.Set(itemBody, "oneOfIpRoute.null0.optionType", "global") itemBody, _ = sjson.Set(itemBody, "oneOfIpRoute.null0.value", item.Null0.ValueBool()) } } - if !item.GatewayDhcp.IsNull() { - if true { + if !item.Dhcp.IsNull() { + if true && item.Gateway.ValueString() == "dhcp" { itemBody, _ = sjson.Set(itemBody, "oneOfIpRoute.dhcp.optionType", "global") - itemBody, _ = sjson.Set(itemBody, "oneOfIpRoute.dhcp.value", item.GatewayDhcp.ValueBool()) + itemBody, _ = sjson.Set(itemBody, "oneOfIpRoute.dhcp.value", item.Dhcp.ValueBool()) } } if !item.Vpn.IsNull() { - if true { + if true && item.Gateway.ValueString() == "vpn" { itemBody, _ = sjson.Set(itemBody, "oneOfIpRoute.vpn.optionType", "global") itemBody, _ = sjson.Set(itemBody, "oneOfIpRoute.vpn.value", item.Vpn.ValueBool()) } @@ -795,7 +797,7 @@ func (data ServiceLANVPN) toBody(ctx context.Context, currentVersion *version.Ve itemBody, _ = sjson.Set(itemBody, "prefix.value", item.Prefix.ValueString()) } } - if true { + if true && item.Gateway.ValueString() == "nextHop" { for _, childItem := range item.NextHops { itemChildBody := "" @@ -827,19 +829,19 @@ func (data ServiceLANVPN) toBody(ctx context.Context, currentVersion *version.Ve } } if !item.Null0.IsNull() { - if true { + if true && item.Gateway.ValueString() == "null0" { itemBody, _ = sjson.Set(itemBody, "oneOfIpRoute.null0.optionType", "global") itemBody, _ = sjson.Set(itemBody, "oneOfIpRoute.null0.value", item.Null0.ValueBool()) } } if !item.NatVariable.IsNull() { - if true { + if true && item.Gateway.ValueString() == "nat" { itemBody, _ = sjson.Set(itemBody, "oneOfIpRoute.nat.optionType", "variable") itemBody, _ = sjson.Set(itemBody, "oneOfIpRoute.nat.value", item.NatVariable.ValueString()) } } else if !item.Nat.IsNull() { - if true { + if true && item.Gateway.ValueString() == "nat" { itemBody, _ = sjson.Set(itemBody, "oneOfIpRoute.nat.optionType", "global") itemBody, _ = sjson.Set(itemBody, "oneOfIpRoute.nat.value", item.Nat.ValueString()) } @@ -1960,12 +1962,12 @@ func (data *ServiceLANVPN) fromBody(ctx context.Context, res gjson.Result, curre item.Null0 = types.BoolValue(va.Bool()) } } - item.GatewayDhcp = types.BoolNull() + item.Dhcp = types.BoolNull() if t := v.Get("oneOfIpRoute.dhcp.optionType"); t.Exists() { va := v.Get("oneOfIpRoute.dhcp.value") if t.String() == "global" { - item.GatewayDhcp = types.BoolValue(va.Bool()) + item.Dhcp = types.BoolValue(va.Bool()) } } item.Vpn = types.BoolNull() @@ -3257,12 +3259,12 @@ func (data *ServiceLANVPN) updateFromBody(ctx context.Context, res gjson.Result, data.Ipv4StaticRoutes[i].Null0 = types.BoolValue(va.Bool()) } } - data.Ipv4StaticRoutes[i].GatewayDhcp = types.BoolNull() + data.Ipv4StaticRoutes[i].Dhcp = types.BoolNull() if t := r.Get("oneOfIpRoute.dhcp.optionType"); t.Exists() { va := r.Get("oneOfIpRoute.dhcp.value") if t.String() == "global" { - data.Ipv4StaticRoutes[i].GatewayDhcp = types.BoolValue(va.Bool()) + data.Ipv4StaticRoutes[i].Dhcp = types.BoolValue(va.Bool()) } } data.Ipv4StaticRoutes[i].Vpn = types.BoolNull() diff --git a/internal/provider/resource_sdwan_service_lan_vpn_feature.go b/internal/provider/resource_sdwan_service_lan_vpn_feature.go index d863353f4..a8d9f94b1 100644 --- a/internal/provider/resource_sdwan_service_lan_vpn_feature.go +++ b/internal/provider/resource_sdwan_service_lan_vpn_feature.go @@ -351,8 +351,15 @@ func (r *ServiceLANVPNProfileParcelResource) Schema(ctx context.Context, req res MarkdownDescription: helpers.NewAttributeDescription("Variable name").String, Optional: true, }, + "gateway": schema.StringAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("Gateway type").AddStringEnumDescription("nextHop", "null0", "vpn", "dhcp").String, + Optional: true, + Validators: []validator.String{ + stringvalidator.OneOf("nextHop", "null0", "vpn", "dhcp"), + }, + }, "next_hops": schema.ListNestedAttribute{ - MarkdownDescription: helpers.NewAttributeDescription("IPv4 Route Gateway Next Hop").String, + MarkdownDescription: helpers.NewAttributeDescription("IPv4 Route Gateway Next Hop, Attribute conditional on `gateway` being equal to `nextHop`").String, Optional: true, NestedObject: schema.NestedAttributeObject{ Attributes: map[string]schema.Attribute{ @@ -379,7 +386,7 @@ func (r *ServiceLANVPNProfileParcelResource) Schema(ctx context.Context, req res }, }, "next_hop_with_trackers": schema.ListNestedAttribute{ - MarkdownDescription: helpers.NewAttributeDescription("IPv4 Route Gateway Next Hop with Tracker").String, + MarkdownDescription: helpers.NewAttributeDescription("IPv4 Route Gateway Next Hop with Tracker, Attribute conditional on `gateway` being equal to `nextHop`").String, Optional: true, NestedObject: schema.NestedAttributeObject{ Attributes: map[string]schema.Attribute{ @@ -413,15 +420,15 @@ func (r *ServiceLANVPNProfileParcelResource) Schema(ctx context.Context, req res }, }, "null0": schema.BoolAttribute{ - MarkdownDescription: helpers.NewAttributeDescription("IPv4 Route Gateway Next Hop").String, + MarkdownDescription: helpers.NewAttributeDescription("IPv4 Route Gateway Next Hop, Attribute conditional on `gateway` being equal to `null0`").String, Optional: true, }, - "gateway_dhcp": schema.BoolAttribute{ - MarkdownDescription: helpers.NewAttributeDescription("IPv4 Route Gateway DHCP").String, + "dhcp": schema.BoolAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("IPv4 Route Gateway DHCP, Attribute conditional on `gateway` being equal to `dhcp`").String, Optional: true, }, "vpn": schema.BoolAttribute{ - MarkdownDescription: helpers.NewAttributeDescription("IPv4 Route Gateway VPN").String, + MarkdownDescription: helpers.NewAttributeDescription("IPv4 Route Gateway VPN, Attribute conditional on `gateway` being equal to `vpn`").String, Optional: true, }, }, @@ -443,8 +450,15 @@ func (r *ServiceLANVPNProfileParcelResource) Schema(ctx context.Context, req res MarkdownDescription: helpers.NewAttributeDescription("Variable name").String, Optional: true, }, + "gateway": schema.StringAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("Gateway type").AddStringEnumDescription("nextHop", "null0", "nat").String, + Optional: true, + Validators: []validator.String{ + stringvalidator.OneOf("nextHop", "null0", "nat"), + }, + }, "next_hops": schema.ListNestedAttribute{ - MarkdownDescription: helpers.NewAttributeDescription("IPv6 Route Gateway Next Hop").String, + MarkdownDescription: helpers.NewAttributeDescription("IPv6 Route Gateway Next Hop, Attribute conditional on `gateway` being equal to `nextHop`").String, Optional: true, NestedObject: schema.NestedAttributeObject{ Attributes: map[string]schema.Attribute{ @@ -471,18 +485,18 @@ func (r *ServiceLANVPNProfileParcelResource) Schema(ctx context.Context, req res }, }, "null0": schema.BoolAttribute{ - MarkdownDescription: helpers.NewAttributeDescription("IPv6 Route Gateway Next Hop").String, + MarkdownDescription: helpers.NewAttributeDescription("IPv6 Route Gateway Next Hop, Attribute conditional on `gateway` being equal to `null0`").String, Optional: true, }, "nat": schema.StringAttribute{ - MarkdownDescription: helpers.NewAttributeDescription("IPv6 Nat").AddStringEnumDescription("NAT64", "NAT66").String, + MarkdownDescription: helpers.NewAttributeDescription("IPv6 Nat, Attribute conditional on `gateway` being equal to `nat`").AddStringEnumDescription("NAT64", "NAT66").String, Optional: true, Validators: []validator.String{ stringvalidator.OneOf("NAT64", "NAT66"), }, }, "nat_variable": schema.StringAttribute{ - MarkdownDescription: helpers.NewAttributeDescription("Variable name").String, + MarkdownDescription: helpers.NewAttributeDescription("Variable name, Attribute conditional on `gateway` being equal to `nat`").String, Optional: true, }, }, diff --git a/internal/provider/resource_sdwan_service_lan_vpn_feature_test.go b/internal/provider/resource_sdwan_service_lan_vpn_feature_test.go index e3844dc79..d1c813037 100644 --- a/internal/provider/resource_sdwan_service_lan_vpn_feature_test.go +++ b/internal/provider/resource_sdwan_service_lan_vpn_feature_test.go @@ -146,6 +146,7 @@ func testAccSdwanServiceLANVPNProfileParcelConfig_all() string { config += ` ipv4_static_routes = [{` + "\n" config += ` network_address = "1.2.3.4"` + "\n" config += ` subnet_mask = "0.0.0.0"` + "\n" + config += ` gateway = "nextHop"` + "\n" config += ` next_hops = [{` + "\n" config += ` address = "1.2.3.4"` + "\n" config += ` administrative_distance = 1` + "\n" @@ -153,6 +154,7 @@ func testAccSdwanServiceLANVPNProfileParcelConfig_all() string { config += ` }]` + "\n" config += ` ipv6_static_routes = [{` + "\n" config += ` prefix = "2001:0:0:1::0/12"` + "\n" + config += ` gateway = "nextHop"` + "\n" config += ` next_hops = [{` + "\n" config += ` address = "2001:0:0:1::0"` + "\n" config += ` administrative_distance = 1` + "\n" diff --git a/templates/guides/changelog.md.tmpl b/templates/guides/changelog.md.tmpl index 3aed93508..70aca3d71 100644 --- a/templates/guides/changelog.md.tmpl +++ b/templates/guides/changelog.md.tmpl @@ -16,6 +16,7 @@ description: |- - 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 - Adds `enhanced_app_aware_routing` support to the `sdwan_cisco_system_feature_template` resource and data source +- Add `gateway` attribute for `ipv4_static_routes` and `ipv6_static_routes` in `sdwan_service_lan_vpn_feature` resource ## 0.6.2