diff --git a/CHANGELOG.md b/CHANGELOG.md index f487be15..618d1603 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.2.11 (unreleased) + +- Fix idempotency issue with various resource and boolean values + ## 0.2.10 - Fix issue with `sdwan_cisco_ospf_feature_template` resource when not configuring route policies diff --git a/docs/data-sources/cisco_vpn_interface_feature_template.md b/docs/data-sources/cisco_vpn_interface_feature_template.md index 16ccf0bb..81cb228b 100644 --- a/docs/data-sources/cisco_vpn_interface_feature_template.md +++ b/docs/data-sources/cisco_vpn_interface_feature_template.md @@ -109,7 +109,6 @@ data "sdwan_cisco_vpn_interface_feature_template" "example" { - `nat_pool_range_start_variable` (String) Variable name - `nat_type` (String) NAT type - `nat_type_variable` (String) Variable name -- `nat_variable` (String) Variable name - `per_tunnel_qos` (Boolean) Per-tunnel Qos - `per_tunnel_qos_aggregator` (Boolean) Per-tunnel QoS Aggregator - `per_tunnel_qos_aggregator_variable` (String) Variable name diff --git a/docs/resources/cisco_vpn_interface_feature_template.md b/docs/resources/cisco_vpn_interface_feature_template.md index 646f5332..3fe1630b 100644 --- a/docs/resources/cisco_vpn_interface_feature_template.md +++ b/docs/resources/cisco_vpn_interface_feature_template.md @@ -352,7 +352,6 @@ resource "sdwan_cisco_vpn_interface_feature_template" "example" { - Choices: `interface`, `pool`, `loopback` - Default value: `interface` - `nat_type_variable` (String) Variable name -- `nat_variable` (String) Variable name - `per_tunnel_qos` (Boolean) Per-tunnel Qos - Default value: `false` - `per_tunnel_qos_aggregator` (Boolean) Per-tunnel QoS Aggregator diff --git a/gen/definitions/feature_templates/cisco_ospf.yaml b/gen/definitions/feature_templates/cisco_ospf.yaml index 11cbeca8..7da1123a 100644 --- a/gen/definitions/feature_templates/cisco_ospf.yaml +++ b/gen/definitions/feature_templates/cisco_ospf.yaml @@ -12,6 +12,7 @@ attributes: example: true - model_name: originate tf_name: default_information_originate + node_only_container: true example: true - model_name: always tf_name: default_information_originate_always diff --git a/gen/definitions/feature_templates/cisco_vpn_interface.yaml b/gen/definitions/feature_templates/cisco_vpn_interface.yaml index b22f34ff..06e449a8 100644 --- a/gen/definitions/feature_templates/cisco_vpn_interface.yaml +++ b/gen/definitions/feature_templates/cisco_vpn_interface.yaml @@ -66,28 +66,37 @@ attributes: - model_name: iperf-server example: 8.8.8.8 - model_name: nat + node_only_container: true example: true - model_name: nat-choice tf_name: nat_type + exclude_ignore: true example: interface - model_name: udp-timeout + exclude_ignore: true example: 1 - model_name: tcp-timeout + exclude_ignore: true example: 60 - model_name: range-start tf_name: nat_pool_range_start + exclude_ignore: true example: 10.1.1.1 - model_name: range-end tf_name: nat_pool_range_end + exclude_ignore: true example: 10.1.1.255 - model_name: overload tf_name: nat_overload + exclude_ignore: true example: false - model_name: loopback-interface tf_name: nat_inside_source_loopback_interface + exclude_ignore: true example: lo1 - model_name: prefix-length tf_name: nat_pool_prefix_length + exclude_ignore: true example: 24 - model_name: enable data_path: [nat64] @@ -101,6 +110,7 @@ attributes: example: false - model_name: static-nat66 tf_name: static_nat66_entries + exclude_ignore: true attributes: - model_name: source-prefix example: 2001:7::/48 @@ -110,6 +120,7 @@ attributes: example: 1 - model_name: static tf_name: static_nat_entries + exclude_ignore: true attributes: - model_name: source-ip example: 10.1.1.1 @@ -122,6 +133,7 @@ attributes: example: 1 - model_name: static-port-forward tf_name: static_port_forward_entries + exclude_ignore: true attributes: - model_name: source-ip example: 10.1.1.1 diff --git a/gen/generator.go b/gen/generator.go index 7370ccc2..e8bc1cef 100644 --- a/gen/generator.go +++ b/gen/generator.go @@ -176,6 +176,7 @@ type YamlConfigAttribute struct { ExcludeTest bool `yaml:"exclude_test"` ExcludeExample bool `yaml:"exclude_example"` ExcludeIgnore bool `yaml:"exclude_ignore"` + NodeOnlyContainer bool `yaml:"node_only_container"` Description string `yaml:"description"` Example string `yaml:"example"` EnumValues []string `yaml:"enum_values"` @@ -401,7 +402,7 @@ func parseFeatureTemplateAttribute(attr *YamlConfigAttribute, model gjson.Result if !ignore && r.Get("objectType").String() != "tree" { attr.Mandatory = true } - if variable && r.Get("objectType").String() != "tree" { + if variable && r.Get("objectType").String() != "tree" && !attr.NodeOnlyContainer { attr.Variable = true } if r.Get("objectType").String() == "tree" && len(attr.Attributes) > 0 { diff --git a/gen/schema/schema.yaml b/gen/schema/schema.yaml index 65a7204d..18d05b79 100644 --- a/gen/schema/schema.yaml +++ b/gen/schema/schema.yaml @@ -35,6 +35,7 @@ attribute: exclude_test: bool(required=False) exclude_example: bool(required=False) exclude_ignore: bool(required=False) # If true the object will not be included in the payload if vipType="ignore" + node_only_container: bool(required=False) # Some node-only attributes are at the same time a container for other attributes, in this case set to "true" description: str(required=False) example: any(str(), int(), bool(), required=False) enum_values: list(str(), required=False) diff --git a/gen/templates/feature_templates/model.go b/gen/templates/feature_templates/model.go index ad432e64..e82dec96 100644 --- a/gen/templates/feature_templates/model.go +++ b/gen/templates/feature_templates/model.go @@ -179,7 +179,7 @@ func (data {{camelCase .Name}}) toBody(ctx context.Context) string { body, _ = sjson.Set(body, path+"{{range .DataPath}}{{.}}.{{end}}{{.ModelName}}."+"vipType", "constant") body, _ = sjson.Set(body, path+"{{range .DataPath}}{{.}}.{{end}}{{.ModelName}}."+"vipValue", data.{{toGoName .TfName}}.Value{{.Type}}()) } - {{- else if eq .Type "Bool"}} + {{- else if and (eq .Type "Bool") (not .NodeOnlyContainer)}} {{if .Variable}} if !data.{{toGoName .TfName}}Variable.IsNull() { body, _ = sjson.Set(body, path+"{{range .DataPath}}{{.}}.{{end}}{{.ModelName}}."+"vipObjectType", "{{.ObjectType}}") @@ -198,6 +198,15 @@ func (data {{camelCase .Name}}) toBody(ctx context.Context) string { body, _ = sjson.Set(body, path+"{{range .DataPath}}{{.}}.{{end}}{{.ModelName}}."+"vipType", "constant") body, _ = sjson.Set(body, path+"{{range .DataPath}}{{.}}.{{end}}{{.ModelName}}."+"vipValue", strconv.FormatBool(data.{{toGoName .TfName}}.ValueBool())) } + {{- else if and (eq .Type "Bool") .NodeOnlyContainer}} + if !data.{{toGoName .TfName}}.IsNull() { + if data.{{toGoName .TfName}}.ValueBool() { + body, _ = sjson.Set(body, path+"{{range .DataPath}}{{.}}.{{end}}{{.ModelName}}", map[string]interface{}{}) + } else { + body, _ = sjson.Set(body, path+"{{range .DataPath}}{{.}}.{{end}}{{.ModelName}}."+"vipObjectType", "{{.ObjectType}}") + body, _ = sjson.Set(body, path+"{{range .DataPath}}{{.}}.{{end}}{{.ModelName}}."+"vipType", "ignore") + } + } {{- else if eq .Type "StringList"}} {{if .Variable}} if !data.{{toGoName .TfName}}Variable.IsNull() { @@ -257,7 +266,7 @@ func (data {{camelCase .Name}}) toBody(ctx context.Context) string { itemBody, _ = sjson.Set(itemBody, "{{range .DataPath}}{{.}}.{{end}}{{.ModelName}}."+"vipType", "constant") itemBody, _ = sjson.Set(itemBody, "{{range .DataPath}}{{.}}.{{end}}{{.ModelName}}."+"vipValue", item.{{toGoName .TfName}}.Value{{.Type}}()) } - {{- else if eq .Type "Bool"}} + {{- else if and (eq .Type "Bool") (not .NodeOnlyContainer)}} {{if .Variable}} if !item.{{toGoName .TfName}}Variable.IsNull() { itemBody, _ = sjson.Set(itemBody, "{{range .DataPath}}{{.}}.{{end}}{{.ModelName}}."+"vipObjectType", "{{.ObjectType}}") @@ -276,6 +285,15 @@ func (data {{camelCase .Name}}) toBody(ctx context.Context) string { itemBody, _ = sjson.Set(itemBody, "{{range .DataPath}}{{.}}.{{end}}{{.ModelName}}."+"vipType", "constant") itemBody, _ = sjson.Set(itemBody, "{{range .DataPath}}{{.}}.{{end}}{{.ModelName}}."+"vipValue", strconv.FormatBool(item.{{toGoName .TfName}}.ValueBool())) } + {{- else if and (eq .Type "Bool") .NodeOnlyContainer}} + if !item.{{toGoName .TfName}}.IsNull() { + if item.{{toGoName .TfName}}.ValueBool() { + itemBody, _ = sjson.Set(itemBody, "{{range .DataPath}}{{.}}.{{end}}{{.ModelName}}", map[string]interface{}{}) + } else { + itemBody, _ = sjson.Set(itemBody, "{{range .DataPath}}{{.}}.{{end}}{{.ModelName}}."+"vipObjectType", "{{.ObjectType}}") + itemBody, _ = sjson.Set(itemBody, "{{range .DataPath}}{{.}}.{{end}}{{.ModelName}}."+"vipType", "ignore") + } + } {{- else if eq .Type "StringList"}} {{if .Variable}} if !item.{{toGoName .TfName}}Variable.IsNull() { @@ -335,7 +353,7 @@ func (data {{camelCase .Name}}) toBody(ctx context.Context) string { itemChildBody, _ = sjson.Set(itemChildBody, "{{range .DataPath}}{{.}}.{{end}}{{.ModelName}}."+"vipType", "constant") itemChildBody, _ = sjson.Set(itemChildBody, "{{range .DataPath}}{{.}}.{{end}}{{.ModelName}}."+"vipValue", childItem.{{toGoName .TfName}}.Value{{.Type}}()) } - {{- else if eq .Type "Bool"}} + {{- else if and (eq .Type "Bool") (not .NodeOnlyContainer)}} {{if .Variable}} if !childItem.{{toGoName .TfName}}Variable.IsNull() { itemChildBody, _ = sjson.Set(itemChildBody, "{{range .DataPath}}{{.}}.{{end}}{{.ModelName}}."+"vipObjectType", "{{.ObjectType}}") @@ -354,6 +372,15 @@ func (data {{camelCase .Name}}) toBody(ctx context.Context) string { itemChildBody, _ = sjson.Set(itemChildBody, "{{range .DataPath}}{{.}}.{{end}}{{.ModelName}}."+"vipType", "constant") itemChildBody, _ = sjson.Set(itemChildBody, "{{range .DataPath}}{{.}}.{{end}}{{.ModelName}}."+"vipValue", strconv.FormatBool(childItem.{{toGoName .TfName}}.ValueBool())) } + {{- else if and (eq .Type "Bool") .NodeOnlyContainer}} + if !childItem.{{toGoName .TfName}}.IsNull() { + if childItem.{{toGoName .TfName}}.ValueBool() { + itemChildBody, _ = sjson.Set(itemChildBody, "{{range .DataPath}}{{.}}.{{end}}{{.ModelName}}", map[string]interface{}{}) + } else { + itemChildBody, _ = sjson.Set(itemChildBody, "{{range .DataPath}}{{.}}.{{end}}{{.ModelName}}."+"vipObjectType", "{{.ObjectType}}") + itemChildBody, _ = sjson.Set(itemChildBody, "{{range .DataPath}}{{.}}.{{end}}{{.ModelName}}."+"vipType", "ignore") + } + } {{- else if eq .Type "StringList"}} {{if .Variable}} if !childItem.{{toGoName .TfName}}Variable.IsNull() { @@ -413,7 +440,7 @@ func (data {{camelCase .Name}}) toBody(ctx context.Context) string { itemChildChildBody, _ = sjson.Set(itemChildChildBody, "{{range .DataPath}}{{.}}.{{end}}{{.ModelName}}."+"vipType", "constant") itemChildChildBody, _ = sjson.Set(itemChildChildBody, "{{range .DataPath}}{{.}}.{{end}}{{.ModelName}}."+"vipValue", childChildItem.{{toGoName .TfName}}.Value{{.Type}}()) } - {{- else if eq .Type "Bool"}} + {{- else if and (eq .Type "Bool") (not .NodeOnlyContainer)}} {{if .Variable}} if !childChildItem.{{toGoName .TfName}}Variable.IsNull() { itemChildChildBody, _ = sjson.Set(itemChildChildBody, "{{range .DataPath}}{{.}}.{{end}}{{.ModelName}}."+"vipObjectType", "{{.ObjectType}}") @@ -432,6 +459,15 @@ func (data {{camelCase .Name}}) toBody(ctx context.Context) string { itemChildChildBody, _ = sjson.Set(itemChildChildBody, "{{range .DataPath}}{{.}}.{{end}}{{.ModelName}}."+"vipType", "constant") itemChildChildBody, _ = sjson.Set(itemChildChildBody, "{{range .DataPath}}{{.}}.{{end}}{{.ModelName}}."+"vipValue", strconv.FormatBool(childChildItem.{{toGoName .TfName}}.ValueBool())) } + {{- else if and (eq .Type "Bool") .NodeOnlyContainer}} + if !childChildItem.{{toGoName .TfName}}.IsNull() { + if childChildItem.{{toGoName .TfName}}.ValueBool() { + itemChildChildBody, _ = sjson.Set(itemChildChildBody, "{{range .DataPath}}{{.}}.{{end}}{{.ModelName}}", map[string]interface{}{}) + } else { + itemChildChildBody, _ = sjson.Set(itemChildChildBody, "{{range .DataPath}}{{.}}.{{end}}{{.ModelName}}."+"vipObjectType", "{{.ObjectType}}") + itemChildChildBody, _ = sjson.Set(itemChildChildBody, "{{range .DataPath}}{{.}}.{{end}}{{.ModelName}}."+"vipType", "ignore") + } + } {{- else if eq .Type "StringList"}} {{if .Variable}} if !childChildItem.{{toGoName .TfName}}Variable.IsNull() { @@ -576,14 +612,18 @@ func (data *{{camelCase .Name}}) fromBody(ctx context.Context, res gjson.Result) data.{{toGoName .TfName}}Variable = types.StringValue(v.String()) {{end}} } else if value.String() == "ignore" { + {{- if .NodeOnlyContainer}} + data.{{toGoName .TfName}} = types.BoolValue(false) + {{- else}} data.{{toGoName .TfName}} = types.BoolNull() + {{- end}} {{if .Variable}}data.{{toGoName .TfName}}Variable = types.StringNull(){{end}} } else if value.String() == "constant" { v := res.Get(path + "{{range .DataPath}}{{.}}.{{end}}{{.ModelName}}.vipValue") data.{{toGoName .TfName}} = types.BoolValue(v.Bool()) {{if .Variable}}data.{{toGoName .TfName}}Variable = types.StringNull(){{end}} } - {{- if eq .ObjectType "node-only"}} + {{- if .NodeOnlyContainer}} } else if value := res.Get(path + "{{range .DataPath}}{{.}}.{{end}}{{.ModelName}}"); value.Exists() { data.{{toGoName .TfName}} = types.BoolValue(true) {{if .Variable}}data.{{toGoName .TfName}}Variable = types.StringNull(){{end}} @@ -693,14 +733,18 @@ func (data *{{camelCase .Name}}) fromBody(ctx context.Context, res gjson.Result) item.{{toGoName .TfName}}Variable = types.StringValue(cv.String()) {{end}} } else if cValue.String() == "ignore" { + {{- if .NodeOnlyContainer}} + item.{{toGoName .TfName}} = types.BoolValue(false) + {{- else}} item.{{toGoName .TfName}} = types.BoolNull() + {{- end}} {{if .Variable}}item.{{toGoName .TfName}}Variable = types.StringNull(){{end}} } else if cValue.String() == "constant" { cv := v.Get("{{range .DataPath}}{{.}}.{{end}}{{.ModelName}}.vipValue") item.{{toGoName .TfName}} = types.BoolValue(cv.Bool()) {{if .Variable}}item.{{toGoName .TfName}}Variable = types.StringNull(){{end}} } - {{- if eq .ObjectType "node-only"}} + {{- if .NodeOnlyContainer}} } else if cValue := v.Get("{{range .DataPath}}{{.}}.{{end}}{{.ModelName}}"); cValue.Exists() { item.{{toGoName .TfName}} = types.BoolValue(true) {{if .Variable}}item.{{toGoName .TfName}}Variable = types.StringNull(){{end}} @@ -809,14 +853,18 @@ func (data *{{camelCase .Name}}) fromBody(ctx context.Context, res gjson.Result) cItem.{{toGoName .TfName}}Variable = types.StringValue(ccv.String()) {{end}} } else if ccValue.String() == "ignore" { + {{- if .NodeOnlyContainer}} + cItem.{{toGoName .TfName}} = types.BoolValue(false) + {{- else}} cItem.{{toGoName .TfName}} = types.BoolNull() + {{- end}} {{if .Variable}}cItem.{{toGoName .TfName}}Variable = types.StringNull(){{end}} } else if ccValue.String() == "constant" { ccv := cv.Get("{{range .DataPath}}{{.}}.{{end}}{{.ModelName}}.vipValue") cItem.{{toGoName .TfName}} = types.BoolValue(ccv.Bool()) {{if .Variable}}cItem.{{toGoName .TfName}}Variable = types.StringNull(){{end}} } - {{- if eq .ObjectType "node-only"}} + {{- if .NodeOnlyContainer}} } else if ccValue := cv.Get("{{range .DataPath}}{{.}}.{{end}}{{.ModelName}}"); ccValue.Exists() { cItem.{{toGoName .TfName}} = types.BoolValue(true) {{if .Variable}}cItem.{{toGoName .TfName}}Variable = types.StringNull(){{end}} @@ -925,13 +973,22 @@ func (data *{{camelCase .Name}}) fromBody(ctx context.Context, res gjson.Result) ccItem.{{toGoName .TfName}}Variable = types.StringValue(cccv.String()) {{end}} } else if cccValue.String() == "ignore" { + {{- if .NodeOnlyContainer}} + ccItem.{{toGoName .TfName}} = types.BoolValue(false) + {{- else}} ccItem.{{toGoName .TfName}} = types.BoolNull() + {{- end}} {{if .Variable}}ccItem.{{toGoName .TfName}}Variable = types.StringNull(){{end}} } else if cccValue.String() == "constant" { cccv := ccv.Get("{{range .DataPath}}{{.}}.{{end}}{{.ModelName}}.vipValue") ccItem.{{toGoName .TfName}} = types.BoolValue(cccv.Bool()) {{if .Variable}}ccItem.{{toGoName .TfName}}Variable = types.StringNull(){{end}} } + {{- if .NodeOnlyContainer}} + } else if cccValue := ccv.Get("{{range .DataPath}}{{.}}.{{end}}{{.ModelName}}"); cccValue.Exists() { + ccItem.{{toGoName .TfName}} = types.BoolValue(true) + {{if .Variable}}ccItem.{{toGoName .TfName}}Variable = types.StringNull(){{end}} + {{- end}} } else { ccItem.{{toGoName .TfName}} = types.BoolNull() {{if .Variable}}ccItem.{{toGoName .TfName}}Variable = types.StringNull(){{end}} diff --git a/internal/provider/data_source_sdwan_cisco_vpn_interface_feature_template.go b/internal/provider/data_source_sdwan_cisco_vpn_interface_feature_template.go index ce3a8cae..ad9dd2a3 100644 --- a/internal/provider/data_source_sdwan_cisco_vpn_interface_feature_template.go +++ b/internal/provider/data_source_sdwan_cisco_vpn_interface_feature_template.go @@ -279,10 +279,6 @@ func (d *CiscoVPNInterfaceFeatureTemplateDataSource) Schema(ctx context.Context, MarkdownDescription: "Network Address Translation on this interface", Computed: true, }, - "nat_variable": schema.StringAttribute{ - MarkdownDescription: helpers.NewAttributeDescription("Variable name").String, - Computed: true, - }, "nat_type": schema.StringAttribute{ MarkdownDescription: "NAT type", Computed: true, diff --git a/internal/provider/model_sdwan_cisco_bgp_feature_template.go b/internal/provider/model_sdwan_cisco_bgp_feature_template.go index 675b1fcb..ae2124e2 100644 --- a/internal/provider/model_sdwan_cisco_bgp_feature_template.go +++ b/internal/provider/model_sdwan_cisco_bgp_feature_template.go @@ -2379,9 +2379,6 @@ func (data *CiscoBGP) fromBody(ctx context.Context, res gjson.Result) { cItem.AsSetPath = types.BoolValue(ccv.Bool()) cItem.AsSetPathVariable = types.StringNull() } - } else if ccValue := cv.Get("as-set"); ccValue.Exists() { - cItem.AsSetPath = types.BoolValue(true) - cItem.AsSetPathVariable = types.StringNull() } else { cItem.AsSetPath = types.BoolNull() cItem.AsSetPathVariable = types.StringNull() @@ -2401,9 +2398,6 @@ func (data *CiscoBGP) fromBody(ctx context.Context, res gjson.Result) { cItem.SummaryOnly = types.BoolValue(ccv.Bool()) cItem.SummaryOnlyVariable = types.StringNull() } - } else if ccValue := cv.Get("summary-only"); ccValue.Exists() { - cItem.SummaryOnly = types.BoolValue(true) - cItem.SummaryOnlyVariable = types.StringNull() } else { cItem.SummaryOnly = types.BoolNull() cItem.SummaryOnlyVariable = types.StringNull() @@ -2455,9 +2449,6 @@ func (data *CiscoBGP) fromBody(ctx context.Context, res gjson.Result) { cItem.AsSetPath = types.BoolValue(ccv.Bool()) cItem.AsSetPathVariable = types.StringNull() } - } else if ccValue := cv.Get("as-set"); ccValue.Exists() { - cItem.AsSetPath = types.BoolValue(true) - cItem.AsSetPathVariable = types.StringNull() } else { cItem.AsSetPath = types.BoolNull() cItem.AsSetPathVariable = types.StringNull() @@ -2477,9 +2468,6 @@ func (data *CiscoBGP) fromBody(ctx context.Context, res gjson.Result) { cItem.SummaryOnly = types.BoolValue(ccv.Bool()) cItem.SummaryOnlyVariable = types.StringNull() } - } else if ccValue := cv.Get("summary-only"); ccValue.Exists() { - cItem.SummaryOnly = types.BoolValue(true) - cItem.SummaryOnlyVariable = types.StringNull() } else { cItem.SummaryOnly = types.BoolNull() cItem.SummaryOnlyVariable = types.StringNull() @@ -2586,9 +2574,6 @@ func (data *CiscoBGP) fromBody(ctx context.Context, res gjson.Result) { item.DefaultInformationOriginate = types.BoolValue(cv.Bool()) item.DefaultInformationOriginateVariable = types.StringNull() } - } else if cValue := v.Get("default-information.originate"); cValue.Exists() { - item.DefaultInformationOriginate = types.BoolValue(true) - item.DefaultInformationOriginateVariable = types.StringNull() } else { item.DefaultInformationOriginate = types.BoolNull() item.DefaultInformationOriginateVariable = types.StringNull() @@ -2627,9 +2612,6 @@ func (data *CiscoBGP) fromBody(ctx context.Context, res gjson.Result) { item.TableMapFilter = types.BoolValue(cv.Bool()) item.TableMapFilterVariable = types.StringNull() } - } else if cValue := v.Get("table-map.filter"); cValue.Exists() { - item.TableMapFilter = types.BoolValue(true) - item.TableMapFilterVariable = types.StringNull() } else { item.TableMapFilter = types.BoolNull() item.TableMapFilterVariable = types.StringNull() diff --git a/internal/provider/model_sdwan_cisco_ospf_feature_template.go b/internal/provider/model_sdwan_cisco_ospf_feature_template.go index 3557657a..5a4be1fc 100644 --- a/internal/provider/model_sdwan_cisco_ospf_feature_template.go +++ b/internal/provider/model_sdwan_cisco_ospf_feature_template.go @@ -196,13 +196,13 @@ func (data CiscoOSPF) toBody(ctx context.Context) string { body, _ = sjson.Set(body, path+"ospf.compatible.rfc1583."+"vipType", "constant") body, _ = sjson.Set(body, path+"ospf.compatible.rfc1583."+"vipValue", strconv.FormatBool(data.CompatibleRfc1583.ValueBool())) } - if data.DefaultInformationOriginate.IsNull() { - body, _ = sjson.Set(body, path+"ospf.default-information.originate."+"vipObjectType", "node-only") - body, _ = sjson.Set(body, path+"ospf.default-information.originate."+"vipType", "ignore") - } else { - body, _ = sjson.Set(body, path+"ospf.default-information.originate."+"vipObjectType", "node-only") - body, _ = sjson.Set(body, path+"ospf.default-information.originate."+"vipType", "constant") - body, _ = sjson.Set(body, path+"ospf.default-information.originate."+"vipValue", strconv.FormatBool(data.DefaultInformationOriginate.ValueBool())) + if !data.DefaultInformationOriginate.IsNull() { + if data.DefaultInformationOriginate.ValueBool() { + body, _ = sjson.Set(body, path+"ospf.default-information.originate", map[string]interface{}{}) + } else { + body, _ = sjson.Set(body, path+"ospf.default-information.originate."+"vipObjectType", "node-only") + body, _ = sjson.Set(body, path+"ospf.default-information.originate."+"vipType", "ignore") + } } if !data.DefaultInformationOriginateAlwaysVariable.IsNull() { @@ -842,7 +842,7 @@ func (data *CiscoOSPF) fromBody(ctx context.Context, res gjson.Result) { data.DefaultInformationOriginate = types.BoolNull() } else if value.String() == "ignore" { - data.DefaultInformationOriginate = types.BoolNull() + data.DefaultInformationOriginate = types.BoolValue(false) } else if value.String() == "constant" { v := res.Get(path + "ospf.default-information.originate.vipValue") @@ -871,9 +871,6 @@ func (data *CiscoOSPF) fromBody(ctx context.Context, res gjson.Result) { data.DefaultInformationOriginateAlways = types.BoolValue(v.Bool()) data.DefaultInformationOriginateAlwaysVariable = types.StringNull() } - } else if value := res.Get(path + "ospf.default-information.originate.always"); value.Exists() { - data.DefaultInformationOriginateAlways = types.BoolValue(true) - data.DefaultInformationOriginateAlwaysVariable = types.StringNull() } else { data.DefaultInformationOriginateAlways = types.BoolNull() data.DefaultInformationOriginateAlwaysVariable = types.StringNull() @@ -1242,9 +1239,6 @@ func (data *CiscoOSPF) fromBody(ctx context.Context, res gjson.Result) { item.StubNoSummary = types.BoolValue(cv.Bool()) item.StubNoSummaryVariable = types.StringNull() } - } else if cValue := v.Get("stub.no-summary"); cValue.Exists() { - item.StubNoSummary = types.BoolValue(true) - item.StubNoSummaryVariable = types.StringNull() } else { item.StubNoSummary = types.BoolNull() item.StubNoSummaryVariable = types.StringNull() @@ -1264,9 +1258,6 @@ func (data *CiscoOSPF) fromBody(ctx context.Context, res gjson.Result) { item.NssaNoSummary = types.BoolValue(cv.Bool()) item.NssaNoSummaryVariable = types.StringNull() } - } else if cValue := v.Get("nssa.no-summary"); cValue.Exists() { - item.NssaNoSummary = types.BoolValue(true) - item.NssaNoSummaryVariable = types.StringNull() } else { item.NssaNoSummary = types.BoolNull() item.NssaNoSummaryVariable = types.StringNull() @@ -1428,9 +1419,6 @@ func (data *CiscoOSPF) fromBody(ctx context.Context, res gjson.Result) { cItem.PassiveInterface = types.BoolValue(ccv.Bool()) cItem.PassiveInterfaceVariable = types.StringNull() } - } else if ccValue := cv.Get("passive-interface"); ccValue.Exists() { - cItem.PassiveInterface = types.BoolValue(true) - cItem.PassiveInterfaceVariable = types.StringNull() } else { cItem.PassiveInterface = types.BoolNull() cItem.PassiveInterfaceVariable = types.StringNull() @@ -1558,9 +1546,6 @@ func (data *CiscoOSPF) fromBody(ctx context.Context, res gjson.Result) { cItem.NoAdvertise = types.BoolValue(ccv.Bool()) cItem.NoAdvertiseVariable = types.StringNull() } - } else if ccValue := cv.Get("no-advertise"); ccValue.Exists() { - cItem.NoAdvertise = types.BoolValue(true) - cItem.NoAdvertiseVariable = types.StringNull() } else { cItem.NoAdvertise = types.BoolNull() cItem.NoAdvertiseVariable = types.StringNull() diff --git a/internal/provider/model_sdwan_cisco_secure_internet_gateway_feature_template.go b/internal/provider/model_sdwan_cisco_secure_internet_gateway_feature_template.go index e7b1ed0c..fb69d22a 100644 --- a/internal/provider/model_sdwan_cisco_secure_internet_gateway_feature_template.go +++ b/internal/provider/model_sdwan_cisco_secure_internet_gateway_feature_template.go @@ -1059,9 +1059,6 @@ func (data *CiscoSecureInternetGateway) fromBody(ctx context.Context, res gjson. item.IpUnnumbered = types.BoolValue(cv.Bool()) } - } else if cValue := v.Get("ip.unnumbered"); cValue.Exists() { - item.IpUnnumbered = types.BoolValue(true) - } else { item.IpUnnumbered = types.BoolNull() @@ -1392,9 +1389,6 @@ func (data *CiscoSecureInternetGateway) fromBody(ctx context.Context, res gjson. item.IkePreSharedKeyDynamic = types.BoolValue(cv.Bool()) } - } else if cValue := v.Get("ike.authentication-type.pre-shared-key-dynamic"); cValue.Exists() { - item.IkePreSharedKeyDynamic = types.BoolValue(true) - } else { item.IkePreSharedKeyDynamic = types.BoolNull() diff --git a/internal/provider/model_sdwan_cisco_security_feature_template.go b/internal/provider/model_sdwan_cisco_security_feature_template.go index 92b20d73..54979259 100644 --- a/internal/provider/model_sdwan_cisco_security_feature_template.go +++ b/internal/provider/model_sdwan_cisco_security_feature_template.go @@ -779,9 +779,6 @@ func (data *CiscoSecurity) fromBody(ctx context.Context, res gjson.Result) { item.SendLifetime = types.BoolValue(cv.Bool()) item.SendLifetimeVariable = types.StringNull() } - } else if cValue := v.Get("send-lifetime.lifetime-group-v1.local"); cValue.Exists() { - item.SendLifetime = types.BoolValue(true) - item.SendLifetimeVariable = types.StringNull() } else { item.SendLifetime = types.BoolNull() item.SendLifetimeVariable = types.StringNull() @@ -868,9 +865,6 @@ func (data *CiscoSecurity) fromBody(ctx context.Context, res gjson.Result) { item.SendLifetimeInfinite = types.BoolValue(cv.Bool()) item.SendLifetimeInfiniteVariable = types.StringNull() } - } else if cValue := v.Get("send-lifetime.lifetime-group-v1.infinite"); cValue.Exists() { - item.SendLifetimeInfinite = types.BoolValue(true) - item.SendLifetimeInfiniteVariable = types.StringNull() } else { item.SendLifetimeInfinite = types.BoolNull() item.SendLifetimeInfiniteVariable = types.StringNull() @@ -890,9 +884,6 @@ func (data *CiscoSecurity) fromBody(ctx context.Context, res gjson.Result) { item.AcceptLifetime = types.BoolValue(cv.Bool()) item.AcceptLifetimeVariable = types.StringNull() } - } else if cValue := v.Get("accept-lifetime.lifetime-group-v1.local"); cValue.Exists() { - item.AcceptLifetime = types.BoolValue(true) - item.AcceptLifetimeVariable = types.StringNull() } else { item.AcceptLifetime = types.BoolNull() item.AcceptLifetimeVariable = types.StringNull() @@ -979,9 +970,6 @@ func (data *CiscoSecurity) fromBody(ctx context.Context, res gjson.Result) { item.AcceptLifetimeInfinite = types.BoolValue(cv.Bool()) item.AcceptLifetimeInfiniteVariable = types.StringNull() } - } else if cValue := v.Get("accept-lifetime.lifetime-group-v1.infinite"); cValue.Exists() { - item.AcceptLifetimeInfinite = types.BoolValue(true) - item.AcceptLifetimeInfiniteVariable = types.StringNull() } else { item.AcceptLifetimeInfinite = types.BoolNull() item.AcceptLifetimeInfiniteVariable = types.StringNull() diff --git a/internal/provider/model_sdwan_cisco_snmp_feature_template.go b/internal/provider/model_sdwan_cisco_snmp_feature_template.go index 6690ac11..9c60e390 100644 --- a/internal/provider/model_sdwan_cisco_snmp_feature_template.go +++ b/internal/provider/model_sdwan_cisco_snmp_feature_template.go @@ -669,9 +669,6 @@ func (data *CiscoSNMP) fromBody(ctx context.Context, res gjson.Result) { cItem.Exclude = types.BoolValue(ccv.Bool()) cItem.ExcludeVariable = types.StringNull() } - } else if ccValue := cv.Get("exclude"); ccValue.Exists() { - cItem.Exclude = types.BoolValue(true) - cItem.ExcludeVariable = types.StringNull() } else { cItem.Exclude = types.BoolNull() cItem.ExcludeVariable = types.StringNull() diff --git a/internal/provider/model_sdwan_cisco_system_feature_template.go b/internal/provider/model_sdwan_cisco_system_feature_template.go index d366a1af..6c2ccaf9 100644 --- a/internal/provider/model_sdwan_cisco_system_feature_template.go +++ b/internal/provider/model_sdwan_cisco_system_feature_template.go @@ -1439,9 +1439,6 @@ func (data *CiscoSystem) fromBody(ctx context.Context, res gjson.Result) { data.MultiTenant = types.BoolValue(v.Bool()) data.MultiTenantVariable = types.StringNull() } - } else if value := res.Get(path + "multi-tenant"); value.Exists() { - data.MultiTenant = types.BoolValue(true) - data.MultiTenantVariable = types.StringNull() } else { data.MultiTenant = types.BoolNull() data.MultiTenantVariable = types.StringNull() diff --git a/internal/provider/model_sdwan_cisco_vpn_feature_template.go b/internal/provider/model_sdwan_cisco_vpn_feature_template.go index 35dce680..df751e2a 100644 --- a/internal/provider/model_sdwan_cisco_vpn_feature_template.go +++ b/internal/provider/model_sdwan_cisco_vpn_feature_template.go @@ -2592,9 +2592,6 @@ func (data *CiscoVPN) fromBody(ctx context.Context, res gjson.Result) { item.Null0 = types.BoolValue(cv.Bool()) item.Null0Variable = types.StringNull() } - } else if cValue := v.Get("null0"); cValue.Exists() { - item.Null0 = types.BoolValue(true) - item.Null0Variable = types.StringNull() } else { item.Null0 = types.BoolNull() item.Null0Variable = types.StringNull() @@ -2652,9 +2649,6 @@ func (data *CiscoVPN) fromBody(ctx context.Context, res gjson.Result) { item.Dhcp = types.BoolValue(cv.Bool()) item.DhcpVariable = types.StringNull() } - } else if cValue := v.Get("dhcp"); cValue.Exists() { - item.Dhcp = types.BoolValue(true) - item.DhcpVariable = types.StringNull() } else { item.Dhcp = types.BoolNull() item.DhcpVariable = types.StringNull() @@ -2827,9 +2821,6 @@ func (data *CiscoVPN) fromBody(ctx context.Context, res gjson.Result) { item.Null0 = types.BoolValue(cv.Bool()) item.Null0Variable = types.StringNull() } - } else if cValue := v.Get("null0"); cValue.Exists() { - item.Null0 = types.BoolValue(true) - item.Null0Variable = types.StringNull() } else { item.Null0 = types.BoolNull() item.Null0Variable = types.StringNull() @@ -3381,9 +3372,6 @@ func (data *CiscoVPN) fromBody(ctx context.Context, res gjson.Result) { item.Overload = types.BoolValue(cv.Bool()) item.OverloadVariable = types.StringNull() } - } else if cValue := v.Get("overload"); cValue.Exists() { - item.Overload = types.BoolValue(true) - item.OverloadVariable = types.StringNull() } else { item.Overload = types.BoolNull() item.OverloadVariable = types.StringNull() diff --git a/internal/provider/model_sdwan_cisco_vpn_interface_feature_template.go b/internal/provider/model_sdwan_cisco_vpn_interface_feature_template.go index 612fa54a..1218a7c9 100644 --- a/internal/provider/model_sdwan_cisco_vpn_interface_feature_template.go +++ b/internal/provider/model_sdwan_cisco_vpn_interface_feature_template.go @@ -65,7 +65,6 @@ type CiscoVPNInterface struct { IperfServer types.String `tfsdk:"iperf_server"` IperfServerVariable types.String `tfsdk:"iperf_server_variable"` Nat types.Bool `tfsdk:"nat"` - NatVariable types.String `tfsdk:"nat_variable"` NatType types.String `tfsdk:"nat_type"` NatTypeVariable types.String `tfsdk:"nat_type_variable"` UdpTimeout types.Int64 `tfsdk:"udp_timeout"` @@ -723,18 +722,13 @@ func (data CiscoVPNInterface) toBody(ctx context.Context) string { body, _ = sjson.Set(body, path+"iperf-server."+"vipType", "constant") body, _ = sjson.Set(body, path+"iperf-server."+"vipValue", data.IperfServer.ValueString()) } - - if !data.NatVariable.IsNull() { - body, _ = sjson.Set(body, path+"nat."+"vipObjectType", "node-only") - body, _ = sjson.Set(body, path+"nat."+"vipType", "variableName") - body, _ = sjson.Set(body, path+"nat."+"vipVariableName", data.NatVariable.ValueString()) - } else if data.Nat.IsNull() { - body, _ = sjson.Set(body, path+"nat."+"vipObjectType", "node-only") - body, _ = sjson.Set(body, path+"nat."+"vipType", "ignore") - } else { - body, _ = sjson.Set(body, path+"nat."+"vipObjectType", "node-only") - body, _ = sjson.Set(body, path+"nat."+"vipType", "constant") - body, _ = sjson.Set(body, path+"nat."+"vipValue", strconv.FormatBool(data.Nat.ValueBool())) + if !data.Nat.IsNull() { + if data.Nat.ValueBool() { + body, _ = sjson.Set(body, path+"nat", map[string]interface{}{}) + } else { + body, _ = sjson.Set(body, path+"nat."+"vipObjectType", "node-only") + body, _ = sjson.Set(body, path+"nat."+"vipType", "ignore") + } } if !data.NatTypeVariable.IsNull() { @@ -742,7 +736,6 @@ func (data CiscoVPNInterface) toBody(ctx context.Context) string { body, _ = sjson.Set(body, path+"nat.nat-choice."+"vipType", "variableName") body, _ = sjson.Set(body, path+"nat.nat-choice."+"vipVariableName", data.NatTypeVariable.ValueString()) } else if data.NatType.IsNull() { - body, _ = sjson.Set(body, path+"nat", map[string]interface{}{}) } else { body, _ = sjson.Set(body, path+"nat.nat-choice."+"vipObjectType", "object") body, _ = sjson.Set(body, path+"nat.nat-choice."+"vipType", "constant") @@ -754,8 +747,6 @@ func (data CiscoVPNInterface) toBody(ctx context.Context) string { body, _ = sjson.Set(body, path+"nat.udp-timeout."+"vipType", "variableName") body, _ = sjson.Set(body, path+"nat.udp-timeout."+"vipVariableName", data.UdpTimeoutVariable.ValueString()) } else if data.UdpTimeout.IsNull() { - body, _ = sjson.Set(body, path+"nat.udp-timeout."+"vipObjectType", "object") - body, _ = sjson.Set(body, path+"nat.udp-timeout."+"vipType", "ignore") } else { body, _ = sjson.Set(body, path+"nat.udp-timeout."+"vipObjectType", "object") body, _ = sjson.Set(body, path+"nat.udp-timeout."+"vipType", "constant") @@ -767,8 +758,6 @@ func (data CiscoVPNInterface) toBody(ctx context.Context) string { body, _ = sjson.Set(body, path+"nat.tcp-timeout."+"vipType", "variableName") body, _ = sjson.Set(body, path+"nat.tcp-timeout."+"vipVariableName", data.TcpTimeoutVariable.ValueString()) } else if data.TcpTimeout.IsNull() { - body, _ = sjson.Set(body, path+"nat.tcp-timeout."+"vipObjectType", "object") - body, _ = sjson.Set(body, path+"nat.tcp-timeout."+"vipType", "ignore") } else { body, _ = sjson.Set(body, path+"nat.tcp-timeout."+"vipObjectType", "object") body, _ = sjson.Set(body, path+"nat.tcp-timeout."+"vipType", "constant") @@ -780,7 +769,6 @@ func (data CiscoVPNInterface) toBody(ctx context.Context) string { body, _ = sjson.Set(body, path+"nat.natpool.range-start."+"vipType", "variableName") body, _ = sjson.Set(body, path+"nat.natpool.range-start."+"vipVariableName", data.NatPoolRangeStartVariable.ValueString()) } else if data.NatPoolRangeStart.IsNull() { - body, _ = sjson.Set(body, path+"nat.natpool", map[string]interface{}{}) } else { body, _ = sjson.Set(body, path+"nat.natpool.range-start."+"vipObjectType", "object") body, _ = sjson.Set(body, path+"nat.natpool.range-start."+"vipType", "constant") @@ -792,7 +780,6 @@ func (data CiscoVPNInterface) toBody(ctx context.Context) string { body, _ = sjson.Set(body, path+"nat.natpool.range-end."+"vipType", "variableName") body, _ = sjson.Set(body, path+"nat.natpool.range-end."+"vipVariableName", data.NatPoolRangeEndVariable.ValueString()) } else if data.NatPoolRangeEnd.IsNull() { - body, _ = sjson.Set(body, path+"nat.natpool", map[string]interface{}{}) } else { body, _ = sjson.Set(body, path+"nat.natpool.range-end."+"vipObjectType", "object") body, _ = sjson.Set(body, path+"nat.natpool.range-end."+"vipType", "constant") @@ -804,8 +791,6 @@ func (data CiscoVPNInterface) toBody(ctx context.Context) string { body, _ = sjson.Set(body, path+"nat.overload."+"vipType", "variableName") body, _ = sjson.Set(body, path+"nat.overload."+"vipVariableName", data.NatOverloadVariable.ValueString()) } else if data.NatOverload.IsNull() { - body, _ = sjson.Set(body, path+"nat.overload."+"vipObjectType", "object") - body, _ = sjson.Set(body, path+"nat.overload."+"vipType", "ignore") } else { body, _ = sjson.Set(body, path+"nat.overload."+"vipObjectType", "object") body, _ = sjson.Set(body, path+"nat.overload."+"vipType", "constant") @@ -817,8 +802,6 @@ func (data CiscoVPNInterface) toBody(ctx context.Context) string { body, _ = sjson.Set(body, path+"nat.interface.loopback-interface."+"vipType", "variableName") body, _ = sjson.Set(body, path+"nat.interface.loopback-interface."+"vipVariableName", data.NatInsideSourceLoopbackInterfaceVariable.ValueString()) } else if data.NatInsideSourceLoopbackInterface.IsNull() { - body, _ = sjson.Set(body, path+"nat.interface.loopback-interface."+"vipObjectType", "object") - body, _ = sjson.Set(body, path+"nat.interface.loopback-interface."+"vipType", "ignore") } else { body, _ = sjson.Set(body, path+"nat.interface.loopback-interface."+"vipObjectType", "object") body, _ = sjson.Set(body, path+"nat.interface.loopback-interface."+"vipType", "constant") @@ -830,7 +813,6 @@ func (data CiscoVPNInterface) toBody(ctx context.Context) string { body, _ = sjson.Set(body, path+"nat.natpool.prefix-length."+"vipType", "variableName") body, _ = sjson.Set(body, path+"nat.natpool.prefix-length."+"vipVariableName", data.NatPoolPrefixLengthVariable.ValueString()) } else if data.NatPoolPrefixLength.IsNull() { - body, _ = sjson.Set(body, path+"nat.natpool", map[string]interface{}{}) } else { body, _ = sjson.Set(body, path+"nat.natpool.prefix-length."+"vipObjectType", "object") body, _ = sjson.Set(body, path+"nat.natpool.prefix-length."+"vipType", "constant") @@ -876,10 +858,6 @@ func (data CiscoVPNInterface) toBody(ctx context.Context) string { body, _ = sjson.Set(body, path+"nat66.static-nat66."+"vipPrimaryKey", []string{"source-prefix", "translated-source-prefix", "source-vpn-id"}) body, _ = sjson.Set(body, path+"nat66.static-nat66."+"vipValue", []interface{}{}) } else { - body, _ = sjson.Set(body, path+"nat66.static-nat66."+"vipObjectType", "tree") - body, _ = sjson.Set(body, path+"nat66.static-nat66."+"vipType", "ignore") - body, _ = sjson.Set(body, path+"nat66.static-nat66."+"vipPrimaryKey", []string{"source-prefix", "translated-source-prefix", "source-vpn-id"}) - body, _ = sjson.Set(body, path+"nat66.static-nat66."+"vipValue", []interface{}{}) } for _, item := range data.StaticNat66Entries { itemBody := "" @@ -938,10 +916,6 @@ func (data CiscoVPNInterface) toBody(ctx context.Context) string { body, _ = sjson.Set(body, path+"nat.static."+"vipPrimaryKey", []string{"source-ip", "translate-ip"}) body, _ = sjson.Set(body, path+"nat.static."+"vipValue", []interface{}{}) } else { - body, _ = sjson.Set(body, path+"nat.static."+"vipObjectType", "tree") - body, _ = sjson.Set(body, path+"nat.static."+"vipType", "ignore") - body, _ = sjson.Set(body, path+"nat.static."+"vipPrimaryKey", []string{"source-ip", "translate-ip"}) - body, _ = sjson.Set(body, path+"nat.static."+"vipValue", []interface{}{}) } for _, item := range data.StaticNatEntries { itemBody := "" @@ -1008,10 +982,6 @@ func (data CiscoVPNInterface) toBody(ctx context.Context) string { body, _ = sjson.Set(body, path+"nat.static-port-forward."+"vipPrimaryKey", []string{"source-ip", "translate-ip", "proto", "source-port", "translate-port"}) body, _ = sjson.Set(body, path+"nat.static-port-forward."+"vipValue", []interface{}{}) } else { - body, _ = sjson.Set(body, path+"nat.static-port-forward."+"vipObjectType", "tree") - body, _ = sjson.Set(body, path+"nat.static-port-forward."+"vipType", "ignore") - body, _ = sjson.Set(body, path+"nat.static-port-forward."+"vipPrimaryKey", []string{"source-ip", "translate-ip", "proto", "source-port", "translate-port"}) - body, _ = sjson.Set(body, path+"nat.static-port-forward."+"vipValue", []interface{}{}) } for _, item := range data.StaticPortForwardEntries { itemBody := "" @@ -2907,23 +2877,20 @@ func (data *CiscoVPNInterface) fromBody(ctx context.Context, res gjson.Result) { if value.String() == "variableName" { data.Nat = types.BoolNull() - v := res.Get(path + "nat.vipVariableName") - data.NatVariable = types.StringValue(v.String()) - } else if value.String() == "ignore" { - data.Nat = types.BoolNull() - data.NatVariable = types.StringNull() + data.Nat = types.BoolValue(false) + } else if value.String() == "constant" { v := res.Get(path + "nat.vipValue") data.Nat = types.BoolValue(v.Bool()) - data.NatVariable = types.StringNull() + } } else if value := res.Get(path + "nat"); value.Exists() { data.Nat = types.BoolValue(true) - data.NatVariable = types.StringNull() + } else { data.Nat = types.BoolNull() - data.NatVariable = types.StringNull() + } if value := res.Get(path + "nat.nat-choice.vipType"); value.Exists() { if value.String() == "variableName" { @@ -3092,9 +3059,6 @@ func (data *CiscoVPNInterface) fromBody(ctx context.Context, res gjson.Result) { data.Ipv6Nat = types.BoolValue(v.Bool()) data.Ipv6NatVariable = types.StringNull() } - } else if value := res.Get(path + "nat64.enable"); value.Exists() { - data.Ipv6Nat = types.BoolValue(true) - data.Ipv6NatVariable = types.StringNull() } else { data.Ipv6Nat = types.BoolNull() data.Ipv6NatVariable = types.StringNull() @@ -3114,9 +3078,6 @@ func (data *CiscoVPNInterface) fromBody(ctx context.Context, res gjson.Result) { data.Nat64Interface = types.BoolValue(v.Bool()) data.Nat64InterfaceVariable = types.StringNull() } - } else if value := res.Get(path + "nat64"); value.Exists() { - data.Nat64Interface = types.BoolValue(true) - data.Nat64InterfaceVariable = types.StringNull() } else { data.Nat64Interface = types.BoolNull() data.Nat64InterfaceVariable = types.StringNull() @@ -3133,9 +3094,6 @@ func (data *CiscoVPNInterface) fromBody(ctx context.Context, res gjson.Result) { data.Nat66Interface = types.BoolValue(v.Bool()) } - } else if value := res.Get(path + "nat66"); value.Exists() { - data.Nat66Interface = types.BoolValue(true) - } else { data.Nat66Interface = types.BoolNull() @@ -3828,9 +3786,6 @@ func (data *CiscoVPNInterface) fromBody(ctx context.Context, res gjson.Result) { data.TunnelInterfaceColorRestrict = types.BoolValue(v.Bool()) data.TunnelInterfaceColorRestrictVariable = types.StringNull() } - } else if value := res.Get(path + "tunnel-interface.color.restrict"); value.Exists() { - data.TunnelInterfaceColorRestrict = types.BoolValue(true) - data.TunnelInterfaceColorRestrictVariable = types.StringNull() } else { data.TunnelInterfaceColorRestrict = types.BoolNull() data.TunnelInterfaceColorRestrictVariable = types.StringNull() @@ -5054,9 +5009,6 @@ func (data *CiscoVPNInterface) fromBody(ctx context.Context, res gjson.Result) { item.TrackOmp = types.BoolValue(cv.Bool()) } - } else if cValue := v.Get("track-omp"); cValue.Exists() { - item.TrackOmp = types.BoolValue(true) - } else { item.TrackOmp = types.BoolNull() @@ -5321,9 +5273,6 @@ func (data *CiscoVPNInterface) fromBody(ctx context.Context, res gjson.Result) { item.TrackOmp = types.BoolValue(cv.Bool()) item.TrackOmpVariable = types.StringNull() } - } else if cValue := v.Get("track-omp"); cValue.Exists() { - item.TrackOmp = types.BoolValue(true) - item.TrackOmpVariable = types.StringNull() } else { item.TrackOmp = types.BoolNull() item.TrackOmpVariable = types.StringNull() @@ -5449,9 +5398,6 @@ func (data *CiscoVPNInterface) fromBody(ctx context.Context, res gjson.Result) { data.StaticSgtTrusted = types.BoolValue(v.Bool()) } - } else if value := res.Get(path + "trustsec.static.trusted"); value.Exists() { - data.StaticSgtTrusted = types.BoolValue(true) - } else { data.StaticSgtTrusted = types.BoolNull() diff --git a/internal/provider/resource_sdwan_cisco_vpn_interface_feature_template.go b/internal/provider/resource_sdwan_cisco_vpn_interface_feature_template.go index b0d3d2e7..7962308f 100644 --- a/internal/provider/resource_sdwan_cisco_vpn_interface_feature_template.go +++ b/internal/provider/resource_sdwan_cisco_vpn_interface_feature_template.go @@ -304,10 +304,6 @@ func (r *CiscoVPNInterfaceFeatureTemplateResource) Schema(ctx context.Context, r MarkdownDescription: helpers.NewAttributeDescription("Network Address Translation on this interface").AddDefaultValueDescription("false").String, Optional: true, }, - "nat_variable": schema.StringAttribute{ - MarkdownDescription: helpers.NewAttributeDescription("Variable name").String, - Optional: true, - }, "nat_type": schema.StringAttribute{ MarkdownDescription: helpers.NewAttributeDescription("NAT type").AddStringEnumDescription("interface", "pool", "loopback").AddDefaultValueDescription("interface").String, Optional: true,