diff --git a/CHANGELOG.md b/CHANGELOG.md index 91180e303..b29eeb426 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ - BREAKING CHANGE: Rename `target_interface` attribute of `sdwan_application_priority_qos_policy` resource to `target_interfaces` - BREAKING CHANGE: Adds `ipv4_configuration_type` and `ipv6_configuration_type` to `sdwan_service_lan_vpn_interface_ethernet_feature` resource - Add `community` support to the `sdwan_route_policy_definition` resource and data source +- Fix problem where `sdwan_cisco_secure_internet_gateway` resource fails to be deployed to a device during device template push, [link](https://github.com/CiscoDevNet/terraform-provider-sdwan/issues/202) +- Fix problem where `sdwan_cedge_pim_feature_template` resource fails to be deployed to a device during device template push, [link](https://github.com/CiscoDevNet/terraform-provider-sdwan/issues/534) - BREAKING CHANGE: Fix type of `imcp_unreachable_allow`, `session_reclassify_allow`, and `unified_logging` in `sdwan_security_policy` resource and data source - BREAKING CHANGE: Fix type of `max_incomplete_icmp_limit`, `max_incomplete_tcp_limit`, and `max_incomplete_upd_limit` in `sdwan_security_policy` resource and data source - BREAKING CHANGE: Converts `source_zone` and `destination_zone` fields to `entries` list containing `source_zone`/`destination_zone` objects to support multiple entries in `sdwan_security_policy` resource and data source diff --git a/docs/guides/changelog.md b/docs/guides/changelog.md index d9a79d4b2..d159f2e74 100644 --- a/docs/guides/changelog.md +++ b/docs/guides/changelog.md @@ -1,18 +1,20 @@ ---- -subcategory: "Guides" -page_title: "Changelog" -description: |- - Changelog ---- - -# Changelog - +--- +subcategory: "Guides" +page_title: "Changelog" +description: |- + Changelog +--- + +# Changelog + ## 0.7.2 (unreleased) - BREAKING CHANGE: Fix type of `port` attribute of `sdwan_port_list_policy_object` to support multiple values, [Link](https://github.com/CiscoDevNet/terraform-provider-sdwan/issues/460) - BREAKING CHANGE: Rename `target_interface` attribute of `sdwan_application_priority_qos_policy` resource to `target_interfaces` - BREAKING CHANGE: Adds `ipv4_configuration_type` and `ipv6_configuration_type` to `sdwan_service_lan_vpn_interface_ethernet_feature` resource - Add `community` support to the `sdwan_route_policy_definition` resource and data source +- Fix problem where `sdwan_cisco_secure_internet_gateway` resource fails to be deployed to a device during device template push, [link](https://github.com/CiscoDevNet/terraform-provider-sdwan/issues/202) +- Fix problem where `sdwan_cedge_pim_feature_template` resource fails to be deployed to a device during device template push, [link](https://github.com/CiscoDevNet/terraform-provider-sdwan/issues/534) - BREAKING CHANGE: Fix type of `imcp_unreachable_allow`, `session_reclassify_allow`, and `unified_logging` in `sdwan_security_policy` resource and data source - BREAKING CHANGE: Fix type of `max_incomplete_icmp_limit`, `max_incomplete_tcp_limit`, and `max_incomplete_upd_limit` in `sdwan_security_policy` resource and data source - BREAKING CHANGE: Converts `source_zone` and `destination_zone` fields to `entries` list containing `source_zone`/`destination_zone` objects to support multiple entries in `sdwan_security_policy` resource and data source @@ -489,4 +491,4 @@ description: |- ## 0.1.0 (July 23, 2021) - Initial Release - + diff --git a/docs/resources/cedge_pim_feature_template.md b/docs/resources/cedge_pim_feature_template.md index 96a02e9f7..11964611a 100644 --- a/docs/resources/cedge_pim_feature_template.md +++ b/docs/resources/cedge_pim_feature_template.md @@ -44,8 +44,8 @@ resource "sdwan_cedge_pim_feature_template" "example" { default = true rp_addresses = [ { - ip_address = "1.2.3.4" access_list = "99" + ip_address = "1.2.3.4" override = false } ] diff --git a/docs/resources/cisco_secure_internet_gateway_feature_template.md b/docs/resources/cisco_secure_internet_gateway_feature_template.md index 1ea03eab9..a97fa121c 100644 --- a/docs/resources/cisco_secure_internet_gateway_feature_template.md +++ b/docs/resources/cisco_secure_internet_gateway_feature_template.md @@ -62,8 +62,8 @@ resource "sdwan_cisco_secure_internet_gateway_feature_template" "example" { interface_pairs = [ { active_interface = "e1" - active_interface_weight = 10 backup_interface = "e2" + active_interface_weight = 10 backup_interface_weight = 20 } ] @@ -92,12 +92,12 @@ resource "sdwan_cisco_secure_internet_gateway_feature_template" "example" { tracker_source_ip = "2.3.4.5" trackers = [ { + tracker_type = "SIG" name = "TRACKER1" endpoint_api_url = "https://1.1.1.1" threshold = 500 interval = 60 multiplier = 4 - tracker_type = "SIG" } ] } diff --git a/examples/resources/sdwan_cedge_pim_feature_template/resource.tf b/examples/resources/sdwan_cedge_pim_feature_template/resource.tf index 5fc10b5ce..0bddeec02 100644 --- a/examples/resources/sdwan_cedge_pim_feature_template/resource.tf +++ b/examples/resources/sdwan_cedge_pim_feature_template/resource.tf @@ -27,8 +27,8 @@ resource "sdwan_cedge_pim_feature_template" "example" { default = true rp_addresses = [ { - ip_address = "1.2.3.4" access_list = "99" + ip_address = "1.2.3.4" override = false } ] diff --git a/examples/resources/sdwan_cisco_secure_internet_gateway_feature_template/resource.tf b/examples/resources/sdwan_cisco_secure_internet_gateway_feature_template/resource.tf index 8b1bfeec2..b0d576e08 100644 --- a/examples/resources/sdwan_cisco_secure_internet_gateway_feature_template/resource.tf +++ b/examples/resources/sdwan_cisco_secure_internet_gateway_feature_template/resource.tf @@ -45,8 +45,8 @@ resource "sdwan_cisco_secure_internet_gateway_feature_template" "example" { interface_pairs = [ { active_interface = "e1" - active_interface_weight = 10 backup_interface = "e2" + active_interface_weight = 10 backup_interface_weight = 20 } ] @@ -75,12 +75,12 @@ resource "sdwan_cisco_secure_internet_gateway_feature_template" "example" { tracker_source_ip = "2.3.4.5" trackers = [ { + tracker_type = "SIG" name = "TRACKER1" endpoint_api_url = "https://1.1.1.1" threshold = 500 interval = 60 multiplier = 4 - tracker_type = "SIG" } ] } diff --git a/gen/definitions/feature_templates/cedge_pim.yaml b/gen/definitions/feature_templates/cedge_pim.yaml index 550b0b479..48e744fe1 100644 --- a/gen/definitions/feature_templates/cedge_pim.yaml +++ b/gen/definitions/feature_templates/cedge_pim.yaml @@ -47,12 +47,13 @@ attributes: example: true - model_name: rp-addr tf_name: rp_addresses + priority_order_always: true attributes: + - model_name: access-list + example: 99 - model_name: address tf_name: ip_address example: 1.2.3.4 - - model_name: access-list - example: 99 - model_name: override example: false - model_name: spt-threshold diff --git a/gen/definitions/feature_templates/cisco_secure_internet_gateway.yaml b/gen/definitions/feature_templates/cisco_secure_internet_gateway.yaml index 1935e1455..93209e2ec 100644 --- a/gen/definitions/feature_templates/cisco_secure_internet_gateway.yaml +++ b/gen/definitions/feature_templates/cisco_secure_internet_gateway.yaml @@ -1,4 +1,5 @@ --- +# Manual resource - toBody is manually configured to support 'notIgnore' values for 'shutdown' and 'mtu' attributes. name: Cisco Secure Internet Gateway minimum_version: 15.0.0 attributes: @@ -57,7 +58,6 @@ attributes: - model_name: pre-shared-secret tf_name: ike_pre_shared_key example: A1234567 - exclude_ignore: true - model_name: ike-rekey-interval example: 600 exclude_ignore: true @@ -74,11 +74,9 @@ attributes: - model_name: ike-local-id tf_name: ike_pre_shared_key_local_id example: 1.2.3.4 - exclude_ignore: true - model_name: ike-remote-id tf_name: ike_pre_shared_key_remote_id example: 2.3.4.5 - exclude_ignore: true - model_name: ipsec-rekey-interval example: 7200 exclude_ignore: true @@ -101,6 +99,7 @@ attributes: example: 5.5.5.5 - model_name: service tf_name: services + priority_order_always: true attributes: - model_name: svc-type tf_name: service_type @@ -111,11 +110,11 @@ attributes: - model_name: active-interface ignore_enum: true example: e1 - - model_name: active-interface-weight - example: 10 - model_name: backup-interface ignore_enum: true example: e2 + - model_name: active-interface-weight + example: 10 - model_name: backup-interface-weight example: 20 - model_name: auth-required @@ -202,7 +201,10 @@ attributes: example: 2.3.4.5 - model_name: tracker tf_name: trackers + priority_order_always: true attributes: + - model_name: tracker-type + example: SIG - model_name: name example: TRACKER1 - model_name: endpoint-api-url @@ -213,5 +215,3 @@ attributes: example: 60 - model_name: multiplier example: 4 - - model_name: tracker-type - example: SIG diff --git a/gen/generator.go b/gen/generator.go index 5451d188e..b4d23a1b0 100644 --- a/gen/generator.go +++ b/gen/generator.go @@ -272,6 +272,7 @@ type YamlConfigAttribute struct { RequiresConstAndVar bool `yaml:"requires_const_and_var"` RequiresReplace bool `yaml:"requires_replace"` DynamicDefault bool `yaml:"dynamic_default"` + PriorityOrderAlways bool `yaml:"priority_order_always"` } type YamlConfigConditionalAttribute struct { diff --git a/gen/schema/schema.yaml b/gen/schema/schema.yaml index 2978bc4f5..fa4c1b6c4 100644 --- a/gen/schema/schema.yaml +++ b/gen/schema/schema.yaml @@ -85,6 +85,7 @@ attribute: requires_const_and_var: bool(required=False) # If true will include both constant and variable values in payload requires_replace: bool(required=False) # If true resource will be recreated when attribute is changed dynamic_default: bool(required=False) # If true when the provided value matches the default value `optionType` will be set to `default` rather than `global` + priority_order_always: bool(required=False) # If true will always set priority-order in feature template payload conditional_attribute: name: str() # Reference to other attribute diff --git a/gen/templates/feature_templates/model.go b/gen/templates/feature_templates/model.go index 937eb6a85..ffb4c59e1 100644 --- a/gen/templates/feature_templates/model.go +++ b/gen/templates/feature_templates/model.go @@ -534,26 +534,38 @@ func (data {{camelCase .Name}}) toBody(ctx context.Context) string { } {{- end}} {{- end}} + {{- if .PriorityOrderAlways}} + itemChildChildBody, _ = sjson.Set(itemChildChildBody, "priority-order", itemChildChildAttributes) + {{- else}} if !childChildItem.Optional.IsNull() { itemChildChildBody, _ = sjson.Set(itemChildChildBody, "vipOptional", childChildItem.Optional.ValueBool()) itemChildChildBody, _ = sjson.Set(itemChildChildBody, "priority-order", itemChildChildAttributes) } + {{- end}} itemChildBody, _ = sjson.SetRaw(itemChildBody, "{{range .DataPath}}{{.}}.{{end}}{{.ModelName}}."+"vipValue.-1", itemChildChildBody) } {{- end}} {{- end}} + {{- if .PriorityOrderAlways}} + itemChildBody, _ = sjson.Set(itemChildBody, "priority-order", itemChildAttributes) + {{- else}} if !childItem.Optional.IsNull() { itemChildBody, _ = sjson.Set(itemChildBody, "vipOptional", childItem.Optional.ValueBool()) itemChildBody, _ = sjson.Set(itemChildBody, "priority-order", itemChildAttributes) } + {{- end}} itemBody, _ = sjson.SetRaw(itemBody, "{{range .DataPath}}{{.}}.{{end}}{{.ModelName}}."+"vipValue.-1", itemChildBody) } {{- end}} {{- end}} + {{- if .PriorityOrderAlways}} + itemBody, _ = sjson.Set(itemBody, "priority-order", itemAttributes) + {{- else}} if !item.Optional.IsNull() { itemBody, _ = sjson.Set(itemBody, "vipOptional", item.Optional.ValueBool()) itemBody, _ = sjson.Set(itemBody, "priority-order", itemAttributes) } + {{- end}} body, _ = sjson.SetRaw(body, path+"{{range .DataPath}}{{.}}.{{end}}{{.ModelName}}."+"vipValue.-1", itemBody) } {{- end}} diff --git a/internal/provider/data_source_sdwan_cedge_pim_feature_template.go b/internal/provider/data_source_sdwan_cedge_pim_feature_template.go index 56007c063..1659cd7c5 100644 --- a/internal/provider/data_source_sdwan_cedge_pim_feature_template.go +++ b/internal/provider/data_source_sdwan_cedge_pim_feature_template.go @@ -238,19 +238,19 @@ func (d *CEdgePIMFeatureTemplateDataSource) Schema(ctx context.Context, req data Computed: true, NestedObject: schema.NestedAttributeObject{ Attributes: map[string]schema.Attribute{ - "ip_address": schema.StringAttribute{ - MarkdownDescription: "Set Static RP IP Address", + "access_list": schema.StringAttribute{ + MarkdownDescription: "Set Static RP Access List", Computed: true, }, - "ip_address_variable": schema.StringAttribute{ + "access_list_variable": schema.StringAttribute{ MarkdownDescription: helpers.NewAttributeDescription("Variable name").String, Computed: true, }, - "access_list": schema.StringAttribute{ - MarkdownDescription: "Set Static RP Access List", + "ip_address": schema.StringAttribute{ + MarkdownDescription: "Set Static RP IP Address", Computed: true, }, - "access_list_variable": schema.StringAttribute{ + "ip_address_variable": schema.StringAttribute{ MarkdownDescription: helpers.NewAttributeDescription("Variable name").String, Computed: true, }, diff --git a/internal/provider/data_source_sdwan_cedge_pim_feature_template_test.go b/internal/provider/data_source_sdwan_cedge_pim_feature_template_test.go index f31aba345..384eeb4ae 100644 --- a/internal/provider/data_source_sdwan_cedge_pim_feature_template_test.go +++ b/internal/provider/data_source_sdwan_cedge_pim_feature_template_test.go @@ -44,8 +44,8 @@ func TestAccDataSourceSdwanCEdgePIMFeatureTemplate(t *testing.T) { checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_cedge_pim_feature_template.test", "scope", "1")) checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_cedge_pim_feature_template.test", "range", "16")) checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_cedge_pim_feature_template.test", "default", "true")) - checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_cedge_pim_feature_template.test", "rp_addresses.0.ip_address", "1.2.3.4")) checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_cedge_pim_feature_template.test", "rp_addresses.0.access_list", "99")) + checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_cedge_pim_feature_template.test", "rp_addresses.0.ip_address", "1.2.3.4")) checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_cedge_pim_feature_template.test", "rp_addresses.0.override", "false")) checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_cedge_pim_feature_template.test", "spt_threshold", "0")) checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_cedge_pim_feature_template.test", "interfaces.0.interface_name", "Ethernet1")) @@ -91,8 +91,8 @@ func testAccDataSourceSdwanCEdgePIMFeatureTemplateConfig() string { config += ` range = "16"` + "\n" config += ` default = true` + "\n" config += ` rp_addresses = [{` + "\n" - config += ` ip_address = "1.2.3.4"` + "\n" config += ` access_list = "99"` + "\n" + config += ` ip_address = "1.2.3.4"` + "\n" config += ` override = false` + "\n" config += ` }]` + "\n" config += ` spt_threshold = "0"` + "\n" diff --git a/internal/provider/data_source_sdwan_cisco_secure_internet_gateway_feature_template.go b/internal/provider/data_source_sdwan_cisco_secure_internet_gateway_feature_template.go index a08f7c044..94d16aa38 100644 --- a/internal/provider/data_source_sdwan_cisco_secure_internet_gateway_feature_template.go +++ b/internal/provider/data_source_sdwan_cisco_secure_internet_gateway_feature_template.go @@ -343,14 +343,14 @@ func (d *CiscoSecureInternetGatewayFeatureTemplateDataSource) Schema(ctx context MarkdownDescription: "Active Tunnel Interface for SIG", Computed: true, }, - "active_interface_weight": schema.Int64Attribute{ - MarkdownDescription: "Active Tunnel Interface Weight", - Computed: true, - }, "backup_interface": schema.StringAttribute{ MarkdownDescription: "Backup Tunnel Interface for SIG", Computed: true, }, + "active_interface_weight": schema.Int64Attribute{ + MarkdownDescription: "Active Tunnel Interface Weight", + Computed: true, + }, "backup_interface_weight": schema.Int64Attribute{ MarkdownDescription: "Backup Tunnel Interface Weight", Computed: true, @@ -482,6 +482,10 @@ func (d *CiscoSecureInternetGatewayFeatureTemplateDataSource) Schema(ctx context Computed: true, NestedObject: schema.NestedAttributeObject{ Attributes: map[string]schema.Attribute{ + "tracker_type": schema.StringAttribute{ + MarkdownDescription: "", + Computed: true, + }, "name": schema.StringAttribute{ MarkdownDescription: "Tracker name", Computed: true, @@ -522,10 +526,6 @@ func (d *CiscoSecureInternetGatewayFeatureTemplateDataSource) Schema(ctx context MarkdownDescription: helpers.NewAttributeDescription("Variable name").String, Computed: true, }, - "tracker_type": schema.StringAttribute{ - MarkdownDescription: "", - Computed: true, - }, "optional": schema.BoolAttribute{ MarkdownDescription: "Indicates if list item is considered optional.", Computed: true, diff --git a/internal/provider/data_source_sdwan_cisco_secure_internet_gateway_feature_template_test.go b/internal/provider/data_source_sdwan_cisco_secure_internet_gateway_feature_template_test.go index 0544718ed..ef9f690c8 100644 --- a/internal/provider/data_source_sdwan_cisco_secure_internet_gateway_feature_template_test.go +++ b/internal/provider/data_source_sdwan_cisco_secure_internet_gateway_feature_template_test.go @@ -64,8 +64,8 @@ func TestAccDataSourceSdwanCiscoSecureInternetGatewayFeatureTemplate(t *testing. checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_cisco_secure_internet_gateway_feature_template.test", "interfaces.0.tunnel_public_ip", "5.5.5.5")) checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_cisco_secure_internet_gateway_feature_template.test", "services.0.service_type", "sig")) checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_cisco_secure_internet_gateway_feature_template.test", "services.0.interface_pairs.0.active_interface", "e1")) - checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_cisco_secure_internet_gateway_feature_template.test", "services.0.interface_pairs.0.active_interface_weight", "10")) checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_cisco_secure_internet_gateway_feature_template.test", "services.0.interface_pairs.0.backup_interface", "e2")) + checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_cisco_secure_internet_gateway_feature_template.test", "services.0.interface_pairs.0.active_interface_weight", "10")) checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_cisco_secure_internet_gateway_feature_template.test", "services.0.interface_pairs.0.backup_interface_weight", "20")) checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_cisco_secure_internet_gateway_feature_template.test", "services.0.zscaler_authentication_required", "true")) checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_cisco_secure_internet_gateway_feature_template.test", "services.0.zscaler_xff_forward", "true")) @@ -88,12 +88,12 @@ func TestAccDataSourceSdwanCiscoSecureInternetGatewayFeatureTemplate(t *testing. checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_cisco_secure_internet_gateway_feature_template.test", "services.0.umbrella_primary_data_center", "Auto")) checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_cisco_secure_internet_gateway_feature_template.test", "services.0.umbrella_secondary_data_center", "Auto")) checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_cisco_secure_internet_gateway_feature_template.test", "tracker_source_ip", "2.3.4.5")) + checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_cisco_secure_internet_gateway_feature_template.test", "trackers.0.tracker_type", "SIG")) checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_cisco_secure_internet_gateway_feature_template.test", "trackers.0.name", "TRACKER1")) checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_cisco_secure_internet_gateway_feature_template.test", "trackers.0.endpoint_api_url", "https://1.1.1.1")) checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_cisco_secure_internet_gateway_feature_template.test", "trackers.0.threshold", "500")) checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_cisco_secure_internet_gateway_feature_template.test", "trackers.0.interval", "60")) checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_cisco_secure_internet_gateway_feature_template.test", "trackers.0.multiplier", "4")) - checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_cisco_secure_internet_gateway_feature_template.test", "trackers.0.tracker_type", "SIG")) resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, @@ -153,8 +153,8 @@ func testAccDataSourceSdwanCiscoSecureInternetGatewayFeatureTemplateConfig() str config += ` service_type = "sig"` + "\n" config += ` interface_pairs = [{` + "\n" config += ` active_interface = "e1"` + "\n" - config += ` active_interface_weight = 10` + "\n" config += ` backup_interface = "e2"` + "\n" + config += ` active_interface_weight = 10` + "\n" config += ` backup_interface_weight = 20` + "\n" config += ` }]` + "\n" config += ` zscaler_authentication_required = true` + "\n" @@ -180,12 +180,12 @@ func testAccDataSourceSdwanCiscoSecureInternetGatewayFeatureTemplateConfig() str config += ` }]` + "\n" config += ` tracker_source_ip = "2.3.4.5"` + "\n" config += ` trackers = [{` + "\n" + config += ` tracker_type = "SIG"` + "\n" config += ` name = "TRACKER1"` + "\n" config += ` endpoint_api_url = "https://1.1.1.1"` + "\n" config += ` threshold = 500` + "\n" config += ` interval = 60` + "\n" config += ` multiplier = 4` + "\n" - config += ` tracker_type = "SIG"` + "\n" config += ` }]` + "\n" config += `}` + "\n" diff --git a/internal/provider/model_sdwan_cedge_pim_feature_template.go b/internal/provider/model_sdwan_cedge_pim_feature_template.go index da9df0ea6..a232556b4 100644 --- a/internal/provider/model_sdwan_cedge_pim_feature_template.go +++ b/internal/provider/model_sdwan_cedge_pim_feature_template.go @@ -86,10 +86,10 @@ type CEdgePIMRpCandidates struct { type CEdgePIMRpAddresses struct { Optional types.Bool `tfsdk:"optional"` - IpAddress types.String `tfsdk:"ip_address"` - IpAddressVariable types.String `tfsdk:"ip_address_variable"` AccessList types.String `tfsdk:"access_list"` AccessListVariable types.String `tfsdk:"access_list_variable"` + IpAddress types.String `tfsdk:"ip_address"` + IpAddressVariable types.String `tfsdk:"ip_address_variable"` Override types.Bool `tfsdk:"override"` OverrideVariable types.String `tfsdk:"override_variable"` } @@ -379,18 +379,6 @@ func (data CEdgePIM) toBody(ctx context.Context) string { for _, item := range data.RpAddresses { itemBody := "" itemAttributes := make([]string, 0) - itemAttributes = append(itemAttributes, "address") - - if !item.IpAddressVariable.IsNull() { - itemBody, _ = sjson.Set(itemBody, "address."+"vipObjectType", "object") - itemBody, _ = sjson.Set(itemBody, "address."+"vipType", "variableName") - itemBody, _ = sjson.Set(itemBody, "address."+"vipVariableName", item.IpAddressVariable.ValueString()) - } else if item.IpAddress.IsNull() { - } else { - itemBody, _ = sjson.Set(itemBody, "address."+"vipObjectType", "object") - itemBody, _ = sjson.Set(itemBody, "address."+"vipType", "constant") - itemBody, _ = sjson.Set(itemBody, "address."+"vipValue", item.IpAddress.ValueString()) - } itemAttributes = append(itemAttributes, "access-list") if !item.AccessListVariable.IsNull() { @@ -403,6 +391,18 @@ func (data CEdgePIM) toBody(ctx context.Context) string { itemBody, _ = sjson.Set(itemBody, "access-list."+"vipType", "constant") itemBody, _ = sjson.Set(itemBody, "access-list."+"vipValue", item.AccessList.ValueString()) } + itemAttributes = append(itemAttributes, "address") + + if !item.IpAddressVariable.IsNull() { + itemBody, _ = sjson.Set(itemBody, "address."+"vipObjectType", "object") + itemBody, _ = sjson.Set(itemBody, "address."+"vipType", "variableName") + itemBody, _ = sjson.Set(itemBody, "address."+"vipVariableName", item.IpAddressVariable.ValueString()) + } else if item.IpAddress.IsNull() { + } else { + itemBody, _ = sjson.Set(itemBody, "address."+"vipObjectType", "object") + itemBody, _ = sjson.Set(itemBody, "address."+"vipType", "constant") + itemBody, _ = sjson.Set(itemBody, "address."+"vipValue", item.IpAddress.ValueString()) + } itemAttributes = append(itemAttributes, "override") if !item.OverrideVariable.IsNull() { @@ -417,10 +417,7 @@ func (data CEdgePIM) toBody(ctx context.Context) string { itemBody, _ = sjson.Set(itemBody, "override."+"vipType", "constant") itemBody, _ = sjson.Set(itemBody, "override."+"vipValue", strconv.FormatBool(item.Override.ValueBool())) } - if !item.Optional.IsNull() { - itemBody, _ = sjson.Set(itemBody, "vipOptional", item.Optional.ValueBool()) - itemBody, _ = sjson.Set(itemBody, "priority-order", itemAttributes) - } + itemBody, _ = sjson.Set(itemBody, "priority-order", itemAttributes) body, _ = sjson.SetRaw(body, path+"pim.rp-addr."+"vipValue.-1", itemBody) } @@ -854,25 +851,6 @@ func (data *CEdgePIM) fromBody(ctx context.Context, res gjson.Result) { } else { item.Optional = types.BoolNull() } - if cValue := v.Get("address.vipType"); cValue.Exists() { - if cValue.String() == "variableName" { - item.IpAddress = types.StringNull() - - cv := v.Get("address.vipVariableName") - item.IpAddressVariable = types.StringValue(cv.String()) - - } else if cValue.String() == "ignore" { - item.IpAddress = types.StringNull() - item.IpAddressVariable = types.StringNull() - } else if cValue.String() == "constant" { - cv := v.Get("address.vipValue") - item.IpAddress = types.StringValue(cv.String()) - item.IpAddressVariable = types.StringNull() - } - } else { - item.IpAddress = types.StringNull() - item.IpAddressVariable = types.StringNull() - } if cValue := v.Get("access-list.vipType"); cValue.Exists() { if cValue.String() == "variableName" { item.AccessList = types.StringNull() @@ -892,6 +870,25 @@ func (data *CEdgePIM) fromBody(ctx context.Context, res gjson.Result) { item.AccessList = types.StringNull() item.AccessListVariable = types.StringNull() } + if cValue := v.Get("address.vipType"); cValue.Exists() { + if cValue.String() == "variableName" { + item.IpAddress = types.StringNull() + + cv := v.Get("address.vipVariableName") + item.IpAddressVariable = types.StringValue(cv.String()) + + } else if cValue.String() == "ignore" { + item.IpAddress = types.StringNull() + item.IpAddressVariable = types.StringNull() + } else if cValue.String() == "constant" { + cv := v.Get("address.vipValue") + item.IpAddress = types.StringValue(cv.String()) + item.IpAddressVariable = types.StringNull() + } + } else { + item.IpAddress = types.StringNull() + item.IpAddressVariable = types.StringNull() + } if cValue := v.Get("override.vipType"); cValue.Exists() { if cValue.String() == "variableName" { item.Override = types.BoolNull() @@ -1080,10 +1077,10 @@ func (data *CEdgePIM) hasChanges(ctx context.Context, state *CEdgePIM) bool { hasChanges = true } else { for i := range data.RpAddresses { - if !data.RpAddresses[i].IpAddress.Equal(state.RpAddresses[i].IpAddress) { + if !data.RpAddresses[i].AccessList.Equal(state.RpAddresses[i].AccessList) { hasChanges = true } - if !data.RpAddresses[i].AccessList.Equal(state.RpAddresses[i].AccessList) { + if !data.RpAddresses[i].IpAddress.Equal(state.RpAddresses[i].IpAddress) { hasChanges = true } if !data.RpAddresses[i].Override.Equal(state.RpAddresses[i].Override) { 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 7064f92a6..6073dbfd5 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 @@ -138,6 +138,7 @@ type CiscoSecureInternetGatewayServices struct { type CiscoSecureInternetGatewayTrackers struct { Optional types.Bool `tfsdk:"optional"` + TrackerType types.String `tfsdk:"tracker_type"` Name types.String `tfsdk:"name"` NameVariable types.String `tfsdk:"name_variable"` EndpointApiUrl types.String `tfsdk:"endpoint_api_url"` @@ -148,14 +149,13 @@ type CiscoSecureInternetGatewayTrackers struct { IntervalVariable types.String `tfsdk:"interval_variable"` Multiplier types.Int64 `tfsdk:"multiplier"` MultiplierVariable types.String `tfsdk:"multiplier_variable"` - TrackerType types.String `tfsdk:"tracker_type"` } type CiscoSecureInternetGatewayServicesInterfacePairs struct { Optional types.Bool `tfsdk:"optional"` ActiveInterface types.String `tfsdk:"active_interface"` - ActiveInterfaceWeight types.Int64 `tfsdk:"active_interface_weight"` BackupInterface types.String `tfsdk:"backup_interface"` + ActiveInterfaceWeight types.Int64 `tfsdk:"active_interface_weight"` BackupInterfaceWeight types.Int64 `tfsdk:"backup_interface_weight"` } @@ -168,7 +168,6 @@ func (data CiscoSecureInternetGateway) getModel() string { // End of section. //template:end getModel -// Section below is generated&owned by "gen/generator.go". //template:begin toBody func (data CiscoSecureInternetGateway) toBody(ctx context.Context) string { body := "" @@ -224,6 +223,9 @@ func (data CiscoSecureInternetGateway) toBody(ctx context.Context) string { } itemAttributes = append(itemAttributes, "shutdown") if item.Shutdown.IsNull() { + itemBody, _ = sjson.Set(itemBody, "shutdown."+"vipObjectType", "object") + itemBody, _ = sjson.Set(itemBody, "shutdown."+"vipType", "notIgnore") + itemBody, _ = sjson.Set(itemBody, "shutdown."+"vipValue", "false") } else { itemBody, _ = sjson.Set(itemBody, "shutdown."+"vipObjectType", "object") itemBody, _ = sjson.Set(itemBody, "shutdown."+"vipType", "constant") @@ -352,6 +354,9 @@ func (data CiscoSecureInternetGateway) toBody(ctx context.Context) string { itemBody, _ = sjson.Set(itemBody, "mtu."+"vipType", "variableName") itemBody, _ = sjson.Set(itemBody, "mtu."+"vipVariableName", item.MtuVariable.ValueString()) } else if item.Mtu.IsNull() { + itemBody, _ = sjson.Set(itemBody, "mtu."+"vipObjectType", "object") + itemBody, _ = sjson.Set(itemBody, "mtu."+"vipType", "notIgnore") + itemBody, _ = sjson.Set(itemBody, "mtu."+"vipValue", 1400) } else { itemBody, _ = sjson.Set(itemBody, "mtu."+"vipObjectType", "object") itemBody, _ = sjson.Set(itemBody, "mtu."+"vipType", "constant") @@ -404,6 +409,8 @@ func (data CiscoSecureInternetGateway) toBody(ctx context.Context) string { itemBody, _ = sjson.Set(itemBody, "ike.authentication-type.pre-shared-key.pre-shared-secret."+"vipType", "variableName") itemBody, _ = sjson.Set(itemBody, "ike.authentication-type.pre-shared-key.pre-shared-secret."+"vipVariableName", item.IkePreSharedKeyVariable.ValueString()) } else if item.IkePreSharedKey.IsNull() { + itemBody, _ = sjson.Set(itemBody, "ike.authentication-type.pre-shared-key.pre-shared-secret."+"vipObjectType", "object") + itemBody, _ = sjson.Set(itemBody, "ike.authentication-type.pre-shared-key.pre-shared-secret."+"vipType", "ignore") } else { itemBody, _ = sjson.Set(itemBody, "ike.authentication-type.pre-shared-key.pre-shared-secret."+"vipObjectType", "object") itemBody, _ = sjson.Set(itemBody, "ike.authentication-type.pre-shared-key.pre-shared-secret."+"vipType", "constant") @@ -459,6 +466,8 @@ func (data CiscoSecureInternetGateway) toBody(ctx context.Context) string { itemBody, _ = sjson.Set(itemBody, "ike.authentication-type.pre-shared-key.ike-local-id."+"vipType", "variableName") itemBody, _ = sjson.Set(itemBody, "ike.authentication-type.pre-shared-key.ike-local-id."+"vipVariableName", item.IkePreSharedKeyLocalIdVariable.ValueString()) } else if item.IkePreSharedKeyLocalId.IsNull() { + itemBody, _ = sjson.Set(itemBody, "ike.authentication-type.pre-shared-key.ike-local-id."+"vipObjectType", "object") + itemBody, _ = sjson.Set(itemBody, "ike.authentication-type.pre-shared-key.ike-local-id."+"vipType", "ignore") } else { itemBody, _ = sjson.Set(itemBody, "ike.authentication-type.pre-shared-key.ike-local-id."+"vipObjectType", "object") itemBody, _ = sjson.Set(itemBody, "ike.authentication-type.pre-shared-key.ike-local-id."+"vipType", "constant") @@ -471,6 +480,8 @@ func (data CiscoSecureInternetGateway) toBody(ctx context.Context) string { itemBody, _ = sjson.Set(itemBody, "ike.authentication-type.pre-shared-key.ike-remote-id."+"vipType", "variableName") itemBody, _ = sjson.Set(itemBody, "ike.authentication-type.pre-shared-key.ike-remote-id."+"vipVariableName", item.IkePreSharedKeyRemoteIdVariable.ValueString()) } else if item.IkePreSharedKeyRemoteId.IsNull() { + itemBody, _ = sjson.Set(itemBody, "ike.authentication-type.pre-shared-key.ike-remote-id."+"vipObjectType", "object") + itemBody, _ = sjson.Set(itemBody, "ike.authentication-type.pre-shared-key.ike-remote-id."+"vipType", "ignore") } else { itemBody, _ = sjson.Set(itemBody, "ike.authentication-type.pre-shared-key.ike-remote-id."+"vipObjectType", "object") itemBody, _ = sjson.Set(itemBody, "ike.authentication-type.pre-shared-key.ike-remote-id."+"vipType", "constant") @@ -605,13 +616,6 @@ func (data CiscoSecureInternetGateway) toBody(ctx context.Context) string { itemChildBody, _ = sjson.Set(itemChildBody, "active-interface."+"vipType", "constant") itemChildBody, _ = sjson.Set(itemChildBody, "active-interface."+"vipValue", childItem.ActiveInterface.ValueString()) } - itemChildAttributes = append(itemChildAttributes, "active-interface-weight") - if childItem.ActiveInterfaceWeight.IsNull() { - } else { - itemChildBody, _ = sjson.Set(itemChildBody, "active-interface-weight."+"vipObjectType", "object") - itemChildBody, _ = sjson.Set(itemChildBody, "active-interface-weight."+"vipType", "constant") - itemChildBody, _ = sjson.Set(itemChildBody, "active-interface-weight."+"vipValue", childItem.ActiveInterfaceWeight.ValueInt64()) - } itemChildAttributes = append(itemChildAttributes, "backup-interface") if childItem.BackupInterface.IsNull() { } else { @@ -619,6 +623,13 @@ func (data CiscoSecureInternetGateway) toBody(ctx context.Context) string { itemChildBody, _ = sjson.Set(itemChildBody, "backup-interface."+"vipType", "constant") itemChildBody, _ = sjson.Set(itemChildBody, "backup-interface."+"vipValue", childItem.BackupInterface.ValueString()) } + itemChildAttributes = append(itemChildAttributes, "active-interface-weight") + if childItem.ActiveInterfaceWeight.IsNull() { + } else { + itemChildBody, _ = sjson.Set(itemChildBody, "active-interface-weight."+"vipObjectType", "object") + itemChildBody, _ = sjson.Set(itemChildBody, "active-interface-weight."+"vipType", "constant") + itemChildBody, _ = sjson.Set(itemChildBody, "active-interface-weight."+"vipValue", childItem.ActiveInterfaceWeight.ValueInt64()) + } itemChildAttributes = append(itemChildAttributes, "backup-interface-weight") if childItem.BackupInterfaceWeight.IsNull() { } else { @@ -799,10 +810,7 @@ func (data CiscoSecureInternetGateway) toBody(ctx context.Context) string { itemBody, _ = sjson.Set(itemBody, "umbrella-data-center.data-center-secondary."+"vipType", "constant") itemBody, _ = sjson.Set(itemBody, "umbrella-data-center.data-center-secondary."+"vipValue", item.UmbrellaSecondaryDataCenter.ValueString()) } - if !item.Optional.IsNull() { - itemBody, _ = sjson.Set(itemBody, "vipOptional", item.Optional.ValueBool()) - itemBody, _ = sjson.Set(itemBody, "priority-order", itemAttributes) - } + itemBody, _ = sjson.Set(itemBody, "priority-order", itemAttributes) body, _ = sjson.SetRaw(body, path+"service."+"vipValue.-1", itemBody) } @@ -830,6 +838,13 @@ func (data CiscoSecureInternetGateway) toBody(ctx context.Context) string { for _, item := range data.Trackers { itemBody := "" itemAttributes := make([]string, 0) + itemAttributes = append(itemAttributes, "tracker-type") + if item.TrackerType.IsNull() { + } else { + itemBody, _ = sjson.Set(itemBody, "tracker-type."+"vipObjectType", "object") + itemBody, _ = sjson.Set(itemBody, "tracker-type."+"vipType", "constant") + itemBody, _ = sjson.Set(itemBody, "tracker-type."+"vipValue", item.TrackerType.ValueString()) + } itemAttributes = append(itemAttributes, "name") if !item.NameVariable.IsNull() { @@ -896,24 +911,12 @@ func (data CiscoSecureInternetGateway) toBody(ctx context.Context) string { itemBody, _ = sjson.Set(itemBody, "multiplier."+"vipType", "constant") itemBody, _ = sjson.Set(itemBody, "multiplier."+"vipValue", item.Multiplier.ValueInt64()) } - itemAttributes = append(itemAttributes, "tracker-type") - if item.TrackerType.IsNull() { - } else { - itemBody, _ = sjson.Set(itemBody, "tracker-type."+"vipObjectType", "object") - itemBody, _ = sjson.Set(itemBody, "tracker-type."+"vipType", "constant") - itemBody, _ = sjson.Set(itemBody, "tracker-type."+"vipValue", item.TrackerType.ValueString()) - } - if !item.Optional.IsNull() { - itemBody, _ = sjson.Set(itemBody, "vipOptional", item.Optional.ValueBool()) - itemBody, _ = sjson.Set(itemBody, "priority-order", itemAttributes) - } + itemBody, _ = sjson.Set(itemBody, "priority-order", itemAttributes) body, _ = sjson.SetRaw(body, path+"tracker."+"vipValue.-1", itemBody) } return body } -// End of section. //template:end toBody - // Section below is generated&owned by "gen/generator.go". //template:begin fromBody func (data *CiscoSecureInternetGateway) fromBody(ctx context.Context, res gjson.Result) { if value := res.Get("deviceType"); value.Exists() { @@ -1602,36 +1605,36 @@ func (data *CiscoSecureInternetGateway) fromBody(ctx context.Context, res gjson. cItem.ActiveInterface = types.StringNull() } - if ccValue := cv.Get("active-interface-weight.vipType"); ccValue.Exists() { + if ccValue := cv.Get("backup-interface.vipType"); ccValue.Exists() { if ccValue.String() == "variableName" { - cItem.ActiveInterfaceWeight = types.Int64Null() + cItem.BackupInterface = types.StringNull() } else if ccValue.String() == "ignore" { - cItem.ActiveInterfaceWeight = types.Int64Null() + cItem.BackupInterface = types.StringNull() } else if ccValue.String() == "constant" { - ccv := cv.Get("active-interface-weight.vipValue") - cItem.ActiveInterfaceWeight = types.Int64Value(ccv.Int()) + ccv := cv.Get("backup-interface.vipValue") + cItem.BackupInterface = types.StringValue(ccv.String()) } } else { - cItem.ActiveInterfaceWeight = types.Int64Null() + cItem.BackupInterface = types.StringNull() } - if ccValue := cv.Get("backup-interface.vipType"); ccValue.Exists() { + if ccValue := cv.Get("active-interface-weight.vipType"); ccValue.Exists() { if ccValue.String() == "variableName" { - cItem.BackupInterface = types.StringNull() + cItem.ActiveInterfaceWeight = types.Int64Null() } else if ccValue.String() == "ignore" { - cItem.BackupInterface = types.StringNull() + cItem.ActiveInterfaceWeight = types.Int64Null() } else if ccValue.String() == "constant" { - ccv := cv.Get("backup-interface.vipValue") - cItem.BackupInterface = types.StringValue(ccv.String()) + ccv := cv.Get("active-interface-weight.vipValue") + cItem.ActiveInterfaceWeight = types.Int64Value(ccv.Int()) } } else { - cItem.BackupInterface = types.StringNull() + cItem.ActiveInterfaceWeight = types.Int64Null() } if ccValue := cv.Get("backup-interface-weight.vipType"); ccValue.Exists() { @@ -2029,6 +2032,22 @@ func (data *CiscoSecureInternetGateway) fromBody(ctx context.Context, res gjson. } else { item.Optional = types.BoolNull() } + if cValue := v.Get("tracker-type.vipType"); cValue.Exists() { + if cValue.String() == "variableName" { + item.TrackerType = types.StringNull() + + } else if cValue.String() == "ignore" { + item.TrackerType = types.StringNull() + + } else if cValue.String() == "constant" { + cv := v.Get("tracker-type.vipValue") + item.TrackerType = types.StringValue(cv.String()) + + } + } else { + item.TrackerType = types.StringNull() + + } if cValue := v.Get("name.vipType"); cValue.Exists() { if cValue.String() == "variableName" { item.Name = types.StringNull() @@ -2124,22 +2143,6 @@ func (data *CiscoSecureInternetGateway) fromBody(ctx context.Context, res gjson. item.Multiplier = types.Int64Null() item.MultiplierVariable = types.StringNull() } - if cValue := v.Get("tracker-type.vipType"); cValue.Exists() { - if cValue.String() == "variableName" { - item.TrackerType = types.StringNull() - - } else if cValue.String() == "ignore" { - item.TrackerType = types.StringNull() - - } else if cValue.String() == "constant" { - cv := v.Get("tracker-type.vipValue") - item.TrackerType = types.StringValue(cv.String()) - - } - } else { - item.TrackerType = types.StringNull() - - } data.Trackers = append(data.Trackers, item) return true }) @@ -2274,10 +2277,10 @@ func (data *CiscoSecureInternetGateway) hasChanges(ctx context.Context, state *C if !data.Services[i].InterfacePairs[ii].ActiveInterface.Equal(state.Services[i].InterfacePairs[ii].ActiveInterface) { hasChanges = true } - if !data.Services[i].InterfacePairs[ii].ActiveInterfaceWeight.Equal(state.Services[i].InterfacePairs[ii].ActiveInterfaceWeight) { + if !data.Services[i].InterfacePairs[ii].BackupInterface.Equal(state.Services[i].InterfacePairs[ii].BackupInterface) { hasChanges = true } - if !data.Services[i].InterfacePairs[ii].BackupInterface.Equal(state.Services[i].InterfacePairs[ii].BackupInterface) { + if !data.Services[i].InterfacePairs[ii].ActiveInterfaceWeight.Equal(state.Services[i].InterfacePairs[ii].ActiveInterfaceWeight) { hasChanges = true } if !data.Services[i].InterfacePairs[ii].BackupInterfaceWeight.Equal(state.Services[i].InterfacePairs[ii].BackupInterfaceWeight) { @@ -2354,6 +2357,9 @@ func (data *CiscoSecureInternetGateway) hasChanges(ctx context.Context, state *C hasChanges = true } else { for i := range data.Trackers { + if !data.Trackers[i].TrackerType.Equal(state.Trackers[i].TrackerType) { + hasChanges = true + } if !data.Trackers[i].Name.Equal(state.Trackers[i].Name) { hasChanges = true } @@ -2369,9 +2375,6 @@ func (data *CiscoSecureInternetGateway) hasChanges(ctx context.Context, state *C if !data.Trackers[i].Multiplier.Equal(state.Trackers[i].Multiplier) { hasChanges = true } - if !data.Trackers[i].TrackerType.Equal(state.Trackers[i].TrackerType) { - hasChanges = true - } } } return hasChanges diff --git a/internal/provider/resource_sdwan_cedge_pim_feature_template.go b/internal/provider/resource_sdwan_cedge_pim_feature_template.go index ce02f1188..a606e90f0 100644 --- a/internal/provider/resource_sdwan_cedge_pim_feature_template.go +++ b/internal/provider/resource_sdwan_cedge_pim_feature_template.go @@ -269,14 +269,6 @@ func (r *CEdgePIMFeatureTemplateResource) Schema(ctx context.Context, req resour Optional: true, NestedObject: schema.NestedAttributeObject{ Attributes: map[string]schema.Attribute{ - "ip_address": schema.StringAttribute{ - MarkdownDescription: helpers.NewAttributeDescription("Set Static RP IP Address").String, - Optional: true, - }, - "ip_address_variable": schema.StringAttribute{ - MarkdownDescription: helpers.NewAttributeDescription("Variable name").String, - Optional: true, - }, "access_list": schema.StringAttribute{ MarkdownDescription: helpers.NewAttributeDescription("Set Static RP Access List").String, Optional: true, @@ -288,6 +280,14 @@ func (r *CEdgePIMFeatureTemplateResource) Schema(ctx context.Context, req resour MarkdownDescription: helpers.NewAttributeDescription("Variable name").String, Optional: true, }, + "ip_address": schema.StringAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("Set Static RP IP Address").String, + Optional: true, + }, + "ip_address_variable": schema.StringAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("Variable name").String, + Optional: true, + }, "override": schema.BoolAttribute{ MarkdownDescription: helpers.NewAttributeDescription("Set override flag").AddDefaultValueDescription("false").String, Optional: true, diff --git a/internal/provider/resource_sdwan_cedge_pim_feature_template_test.go b/internal/provider/resource_sdwan_cedge_pim_feature_template_test.go index b4e63d560..16b6979d0 100644 --- a/internal/provider/resource_sdwan_cedge_pim_feature_template_test.go +++ b/internal/provider/resource_sdwan_cedge_pim_feature_template_test.go @@ -44,8 +44,8 @@ func TestAccSdwanCEdgePIMFeatureTemplate(t *testing.T) { checks = append(checks, resource.TestCheckResourceAttr("sdwan_cedge_pim_feature_template.test", "scope", "1")) checks = append(checks, resource.TestCheckResourceAttr("sdwan_cedge_pim_feature_template.test", "range", "16")) checks = append(checks, resource.TestCheckResourceAttr("sdwan_cedge_pim_feature_template.test", "default", "true")) - checks = append(checks, resource.TestCheckResourceAttr("sdwan_cedge_pim_feature_template.test", "rp_addresses.0.ip_address", "1.2.3.4")) checks = append(checks, resource.TestCheckResourceAttr("sdwan_cedge_pim_feature_template.test", "rp_addresses.0.access_list", "99")) + checks = append(checks, resource.TestCheckResourceAttr("sdwan_cedge_pim_feature_template.test", "rp_addresses.0.ip_address", "1.2.3.4")) checks = append(checks, resource.TestCheckResourceAttr("sdwan_cedge_pim_feature_template.test", "rp_addresses.0.override", "false")) checks = append(checks, resource.TestCheckResourceAttr("sdwan_cedge_pim_feature_template.test", "spt_threshold", "0")) checks = append(checks, resource.TestCheckResourceAttr("sdwan_cedge_pim_feature_template.test", "interfaces.0.interface_name", "Ethernet1")) @@ -109,8 +109,8 @@ func testAccSdwanCEdgePIMFeatureTemplateConfig_all() string { config += ` range = "16"` + "\n" config += ` default = true` + "\n" config += ` rp_addresses = [{` + "\n" - config += ` ip_address = "1.2.3.4"` + "\n" config += ` access_list = "99"` + "\n" + config += ` ip_address = "1.2.3.4"` + "\n" config += ` override = false` + "\n" config += ` }]` + "\n" config += ` spt_threshold = "0"` + "\n" diff --git a/internal/provider/resource_sdwan_cisco_secure_internet_gateway_feature_template.go b/internal/provider/resource_sdwan_cisco_secure_internet_gateway_feature_template.go index 71433416e..4b36356e0 100644 --- a/internal/provider/resource_sdwan_cisco_secure_internet_gateway_feature_template.go +++ b/internal/provider/resource_sdwan_cisco_secure_internet_gateway_feature_template.go @@ -419,6 +419,10 @@ func (r *CiscoSecureInternetGatewayFeatureTemplateResource) Schema(ctx context.C MarkdownDescription: helpers.NewAttributeDescription("Active Tunnel Interface for SIG").String, Optional: true, }, + "backup_interface": schema.StringAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("Backup Tunnel Interface for SIG").String, + Optional: true, + }, "active_interface_weight": schema.Int64Attribute{ MarkdownDescription: helpers.NewAttributeDescription("Active Tunnel Interface Weight").AddIntegerRangeDescription(1, 255).AddDefaultValueDescription("1").String, Optional: true, @@ -426,10 +430,6 @@ func (r *CiscoSecureInternetGatewayFeatureTemplateResource) Schema(ctx context.C int64validator.Between(1, 255), }, }, - "backup_interface": schema.StringAttribute{ - MarkdownDescription: helpers.NewAttributeDescription("Backup Tunnel Interface for SIG").String, - Optional: true, - }, "backup_interface_weight": schema.Int64Attribute{ MarkdownDescription: helpers.NewAttributeDescription("Backup Tunnel Interface Weight").AddIntegerRangeDescription(1, 255).AddDefaultValueDescription("1").String, Optional: true, @@ -570,6 +570,13 @@ func (r *CiscoSecureInternetGatewayFeatureTemplateResource) Schema(ctx context.C Optional: true, NestedObject: schema.NestedAttributeObject{ Attributes: map[string]schema.Attribute{ + "tracker_type": schema.StringAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("").AddStringEnumDescription("SIG").AddDefaultValueDescription(" SIG").String, + Optional: true, + Validators: []validator.String{ + stringvalidator.OneOf("SIG"), + }, + }, "name": schema.StringAttribute{ MarkdownDescription: helpers.NewAttributeDescription("Tracker name").String, Optional: true, @@ -625,13 +632,6 @@ func (r *CiscoSecureInternetGatewayFeatureTemplateResource) Schema(ctx context.C MarkdownDescription: helpers.NewAttributeDescription("Variable name").String, Optional: true, }, - "tracker_type": schema.StringAttribute{ - MarkdownDescription: helpers.NewAttributeDescription("").AddStringEnumDescription("SIG").AddDefaultValueDescription(" SIG").String, - Optional: true, - Validators: []validator.String{ - stringvalidator.OneOf("SIG"), - }, - }, "optional": schema.BoolAttribute{ MarkdownDescription: "Indicates if list item is considered optional.", Optional: true, diff --git a/internal/provider/resource_sdwan_cisco_secure_internet_gateway_feature_template_test.go b/internal/provider/resource_sdwan_cisco_secure_internet_gateway_feature_template_test.go index 03493ecaf..82d8a07de 100644 --- a/internal/provider/resource_sdwan_cisco_secure_internet_gateway_feature_template_test.go +++ b/internal/provider/resource_sdwan_cisco_secure_internet_gateway_feature_template_test.go @@ -64,8 +64,8 @@ func TestAccSdwanCiscoSecureInternetGatewayFeatureTemplate(t *testing.T) { checks = append(checks, resource.TestCheckResourceAttr("sdwan_cisco_secure_internet_gateway_feature_template.test", "interfaces.0.tunnel_public_ip", "5.5.5.5")) checks = append(checks, resource.TestCheckResourceAttr("sdwan_cisco_secure_internet_gateway_feature_template.test", "services.0.service_type", "sig")) checks = append(checks, resource.TestCheckResourceAttr("sdwan_cisco_secure_internet_gateway_feature_template.test", "services.0.interface_pairs.0.active_interface", "e1")) - checks = append(checks, resource.TestCheckResourceAttr("sdwan_cisco_secure_internet_gateway_feature_template.test", "services.0.interface_pairs.0.active_interface_weight", "10")) checks = append(checks, resource.TestCheckResourceAttr("sdwan_cisco_secure_internet_gateway_feature_template.test", "services.0.interface_pairs.0.backup_interface", "e2")) + checks = append(checks, resource.TestCheckResourceAttr("sdwan_cisco_secure_internet_gateway_feature_template.test", "services.0.interface_pairs.0.active_interface_weight", "10")) checks = append(checks, resource.TestCheckResourceAttr("sdwan_cisco_secure_internet_gateway_feature_template.test", "services.0.interface_pairs.0.backup_interface_weight", "20")) checks = append(checks, resource.TestCheckResourceAttr("sdwan_cisco_secure_internet_gateway_feature_template.test", "services.0.zscaler_authentication_required", "true")) checks = append(checks, resource.TestCheckResourceAttr("sdwan_cisco_secure_internet_gateway_feature_template.test", "services.0.zscaler_xff_forward", "true")) @@ -88,12 +88,12 @@ func TestAccSdwanCiscoSecureInternetGatewayFeatureTemplate(t *testing.T) { checks = append(checks, resource.TestCheckResourceAttr("sdwan_cisco_secure_internet_gateway_feature_template.test", "services.0.umbrella_primary_data_center", "Auto")) checks = append(checks, resource.TestCheckResourceAttr("sdwan_cisco_secure_internet_gateway_feature_template.test", "services.0.umbrella_secondary_data_center", "Auto")) checks = append(checks, resource.TestCheckResourceAttr("sdwan_cisco_secure_internet_gateway_feature_template.test", "tracker_source_ip", "2.3.4.5")) + checks = append(checks, resource.TestCheckResourceAttr("sdwan_cisco_secure_internet_gateway_feature_template.test", "trackers.0.tracker_type", "SIG")) checks = append(checks, resource.TestCheckResourceAttr("sdwan_cisco_secure_internet_gateway_feature_template.test", "trackers.0.name", "TRACKER1")) checks = append(checks, resource.TestCheckResourceAttr("sdwan_cisco_secure_internet_gateway_feature_template.test", "trackers.0.endpoint_api_url", "https://1.1.1.1")) checks = append(checks, resource.TestCheckResourceAttr("sdwan_cisco_secure_internet_gateway_feature_template.test", "trackers.0.threshold", "500")) checks = append(checks, resource.TestCheckResourceAttr("sdwan_cisco_secure_internet_gateway_feature_template.test", "trackers.0.interval", "60")) checks = append(checks, resource.TestCheckResourceAttr("sdwan_cisco_secure_internet_gateway_feature_template.test", "trackers.0.multiplier", "4")) - checks = append(checks, resource.TestCheckResourceAttr("sdwan_cisco_secure_internet_gateway_feature_template.test", "trackers.0.tracker_type", "SIG")) resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, @@ -171,8 +171,8 @@ func testAccSdwanCiscoSecureInternetGatewayFeatureTemplateConfig_all() string { config += ` service_type = "sig"` + "\n" config += ` interface_pairs = [{` + "\n" config += ` active_interface = "e1"` + "\n" - config += ` active_interface_weight = 10` + "\n" config += ` backup_interface = "e2"` + "\n" + config += ` active_interface_weight = 10` + "\n" config += ` backup_interface_weight = 20` + "\n" config += ` }]` + "\n" config += ` zscaler_authentication_required = true` + "\n" @@ -198,12 +198,12 @@ func testAccSdwanCiscoSecureInternetGatewayFeatureTemplateConfig_all() string { config += ` }]` + "\n" config += ` tracker_source_ip = "2.3.4.5"` + "\n" config += ` trackers = [{` + "\n" + config += ` tracker_type = "SIG"` + "\n" config += ` name = "TRACKER1"` + "\n" config += ` endpoint_api_url = "https://1.1.1.1"` + "\n" config += ` threshold = 500` + "\n" config += ` interval = 60` + "\n" config += ` multiplier = 4` + "\n" - config += ` tracker_type = "SIG"` + "\n" config += ` }]` + "\n" config += `}` + "\n" return config diff --git a/templates/guides/changelog.md.tmpl b/templates/guides/changelog.md.tmpl index d9a79d4b2..d159f2e74 100644 --- a/templates/guides/changelog.md.tmpl +++ b/templates/guides/changelog.md.tmpl @@ -1,18 +1,20 @@ ---- -subcategory: "Guides" -page_title: "Changelog" -description: |- - Changelog ---- - -# Changelog - +--- +subcategory: "Guides" +page_title: "Changelog" +description: |- + Changelog +--- + +# Changelog + ## 0.7.2 (unreleased) - BREAKING CHANGE: Fix type of `port` attribute of `sdwan_port_list_policy_object` to support multiple values, [Link](https://github.com/CiscoDevNet/terraform-provider-sdwan/issues/460) - BREAKING CHANGE: Rename `target_interface` attribute of `sdwan_application_priority_qos_policy` resource to `target_interfaces` - BREAKING CHANGE: Adds `ipv4_configuration_type` and `ipv6_configuration_type` to `sdwan_service_lan_vpn_interface_ethernet_feature` resource - Add `community` support to the `sdwan_route_policy_definition` resource and data source +- Fix problem where `sdwan_cisco_secure_internet_gateway` resource fails to be deployed to a device during device template push, [link](https://github.com/CiscoDevNet/terraform-provider-sdwan/issues/202) +- Fix problem where `sdwan_cedge_pim_feature_template` resource fails to be deployed to a device during device template push, [link](https://github.com/CiscoDevNet/terraform-provider-sdwan/issues/534) - BREAKING CHANGE: Fix type of `imcp_unreachable_allow`, `session_reclassify_allow`, and `unified_logging` in `sdwan_security_policy` resource and data source - BREAKING CHANGE: Fix type of `max_incomplete_icmp_limit`, `max_incomplete_tcp_limit`, and `max_incomplete_upd_limit` in `sdwan_security_policy` resource and data source - BREAKING CHANGE: Converts `source_zone` and `destination_zone` fields to `entries` list containing `source_zone`/`destination_zone` objects to support multiple entries in `sdwan_security_policy` resource and data source @@ -489,4 +491,4 @@ description: |- ## 0.1.0 (July 23, 2021) - Initial Release - +