Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into tracker
Browse files Browse the repository at this point in the history
  • Loading branch information
seconroy committed Aug 12, 2024
2 parents b8fe4fd + 424d636 commit 717b793
Show file tree
Hide file tree
Showing 84 changed files with 149 additions and 138 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
## 0.3.14 (unreleased)

- Fix issue when reading deleted `sdwan_cli_config_profile_parcel` resource, [link](https://github.com/CiscoDevNet/terraform-provider-sdwan/issues/291)
- Add `sdwan_transport_tracker_group_profile_parcel` resource and data source
- Add `sdwan_transport_tracker_profile_parcel` resource and data source
- Add `sdwan_service_tracker_group_profile_parcel` resource and data source
- Add `sdwan_transport_ipv6_tracker_group_profile_parcel` resource and data source
- Add `sdwan_transport_tracker_group_profile_parcel` resource and data source

## 0.3.13

Expand Down
2 changes: 1 addition & 1 deletion docs/data-sources/traffic_data_policy_definition.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Read-Only:
- `log` (Boolean) Enable logging
- `loss_correction` (String) Loss correction
- `loss_correction_fec` (String) Loss correction FEC
- `loss_correction_fec_threshold` (Number) Loss correction FEC threshold
- `loss_correction_fec_threshold` (String) Loss correction FEC threshold
- `loss_correction_packet_duplication` (String) Loss correction packet duplication
- `nat_parameters` (Attributes List) List of NAT parameters (see [below for nested schema](#nestedatt--sequences--action_entries--nat_parameters))
- `nat_pool` (String) NAT pool
Expand Down
21 changes: 11 additions & 10 deletions docs/guides/changelog.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
---
subcategory: "Guides"
page_title: "Changelog"
description: |-
Changelog
---

# Changelog

---
subcategory: "Guides"
page_title: "Changelog"
description: |-
Changelog
---

# Changelog

## 0.3.14 (unreleased)

- Fix issue when reading deleted `sdwan_cli_config_profile_parcel` resource, [link](https://github.com/CiscoDevNet/terraform-provider-sdwan/issues/291)
- Add `sdwan_transport_tracker_profile_parcel` resource and data source
- Add `sdwan_service_tracker_group_profile_parcel` resource and data source
- Add `sdwan_transport_ipv6_tracker_group_profile_parcel` resource and data source
Expand Down Expand Up @@ -297,4 +298,4 @@ description: |-
## 0.1.0 (July 23, 2021)

- Initial Release


2 changes: 1 addition & 1 deletion docs/resources/feature_device_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Required:

- `id` (String) Feature template ID
- `type` (String) Feature template type
- Choices: `cisco_system`, `cisco_logging`, `cedge_aaa`, `cisco_bfd`, `cisco_omp`, `cisco_security`, `cisco_banner`, `cisco_snmp`, `cedge_global`, `cli-template`, `cisco_sig_credentials`, `switchport`, `cisco_thousandeyes`, `cisco_vpn`
- Choices: `cisco_system`, `cisco_logging`, `cedge_aaa`, `cisco_bfd`, `cisco_omp`, `cisco_security`, `cisco_banner`, `cisco_snmp`, `cedge_global`, `cli-template`, `cisco_sig_credentials`, `switchport`, `cisco_thousandeyes`, `cisco_vpn`, `virtual-application-utd`

Optional:

Expand Down
3 changes: 1 addition & 2 deletions docs/resources/traffic_data_policy_definition.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,7 @@ Optional:
- Choices: `fecAdaptive`, `fecAlways`, `packetDuplication`
- `loss_correction_fec` (String) Loss correction FEC
- Choices: `fecAdaptive`, `fecAlways`, `packetDuplication`
- `loss_correction_fec_threshold` (Number) Loss correction FEC threshold
- Range: `1`-`5`
- `loss_correction_fec_threshold` (String) Loss correction FEC threshold
- `loss_correction_packet_duplication` (String) Loss correction packet duplication
- Choices: `fecAdaptive`, `fecAlways`, `packetDuplication`
- `nat_parameters` (Attributes List) List of NAT parameters (see [below for nested schema](#nestedatt--sequences--action_entries--nat_parameters))
Expand Down
2 changes: 1 addition & 1 deletion gen/definitions/generic/feature_device_template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ attributes:
tf_name: type
type: String
mandatory: true
enum_values: [cisco_system, cisco_logging, cedge_aaa, cisco_bfd, cisco_omp, cisco_security, cisco_banner, cisco_snmp, cedge_global, cli-template, cisco_sig_credentials, switchport, cisco_thousandeyes, cisco_vpn]
enum_values: [cisco_system, cisco_logging, cedge_aaa, cisco_bfd, cisco_omp, cisco_security, cisco_banner, cisco_snmp, cedge_global, cli-template, cisco_sig_credentials, switchport, cisco_thousandeyes, cisco_vpn, virtual-application-utd]
ignore_enum: true
description: Feature template type
example: cisco_system
Expand Down
4 changes: 1 addition & 3 deletions gen/definitions/generic/traffic_data_policy_definition.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -387,10 +387,8 @@ attributes:
conditional_attribute:
name: type
value: lossProtectFec
type: Int64
type: String
description: Loss correction FEC threshold
min_int: 1
max_int: 5
example: 2
exclude_test: true
- model_name: field
Expand Down
4 changes: 2 additions & 2 deletions gen/definitions/profile_parcels/transport_routing_bgp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ attributes:
- model_name: refId
tf_name: ipv4_table_map_route_policy_id
data_path: [addressFamily, name]
# exclude_null: true
always_include_parent: true
exclude_test: true
example: a509839f-33aa-492a-ab8e-6a6fe70d7d79
# # test_value:
Expand Down Expand Up @@ -305,7 +305,7 @@ attributes:
- model_name: refId
tf_name: ipv6_table_map_route_policy_id
data_path: [ipv6AddressFamily, name]
# exclude_null: true
always_include_parent: true
exclude_test: true
example: a509839f-33aa-492a-ab8e-6a6fe70d7d79
# test_value:
Expand Down
1 change: 1 addition & 0 deletions gen/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ type YamlConfigAttribute struct {
SecondaryTestValue string `yaml:"secondary_test_value"`
MinimumTestValue string `yaml:"minimum_test_value"`
AlwaysInclude bool `yaml:"always_include"`
AlwaysIncludeParent bool `yaml:"always_include_parent"`
Attributes []YamlConfigAttribute `yaml:"attributes"`
ConditionalAttribute YamlConfigConditionalAttribute `yaml:"conditional_attribute"`
ConditionalListLength string `yaml:"conditional_list_length"`
Expand Down
1 change: 1 addition & 0 deletions gen/schema/schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ attribute:
minimum_test_value: any(str(), int(), bool(), num(), required=False) # Value used for "minimum" resource acceptance test
exclude_minimum_test: bool(required=False)
always_include: bool(required=False) # Include attribute always in payload
always_include_parent: bool(required=False) # Include attributes parent always in payload
attributes: list(include('attribute'), required=False) # List of attributes, only relevant if type is "List" or "Set"
conditional_attribute: include('conditional_attribute', required=False) # Add attribute to payload only if condition is true
conditional_list_length: str(required=False) # Add attribute to payload only if referenced list has a length greater than 0
Expand Down
2 changes: 1 addition & 1 deletion gen/templates/generic/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ func (r *{{camelCase .Name}}Resource) Read(ctx context.Context, req resource.Rea
tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String()))

res, err := r.client.Get({{if .GetRestEndpoint}}"{{.GetRestEndpoint}}"{{else}}state.getPath(){{end}}{{if not .RemoveId}} + url.QueryEscape(state.Id.ValueString()){{end}})
if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") {
if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") || strings.Contains(res.Get("error.message").String(), "Invalid feature Id") {
resp.State.RemoveResource(ctx)
return
} else if err != nil {
Expand Down
8 changes: 8 additions & 0 deletions gen/templates/profile_parcels/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,8 @@ func (data {{camelCase .Name}}) toBody(ctx context.Context) string {
} else {{end}}{{if and .DefaultValuePresent (not .ExcludeNull)}}if data.{{toGoName .TfName}}.IsNull() {
body, _ = sjson.Set(body, path+"{{range .DataPath}}{{.}}.{{end}}{{.ModelName}}.optionType", "default")
{{if or .DefaultValue .DefaultValueEmptyString}}body, _ = sjson.Set(body, path+"{{range .DataPath}}{{.}}.{{end}}{{.ModelName}}.value", {{if eq .Type "String"}}"{{end}}{{.DefaultValue}}{{if eq .Type "String"}}"{{end}}){{end}}
} else {{else if .AlwaysIncludeParent }}if data.{{toGoName .TfName}}.IsNull() {
body, _ = sjson.Set(body, path+"{{range .DataPath}}{{.}}.{{end}}optionType", "default")
} else {{else}}if !data.{{toGoName .TfName}}.IsNull(){{end}} {
body, _ = sjson.Set(body, path+"{{range .DataPath}}{{.}}.{{end}}{{.ModelName}}.optionType", "global")
{{- if isListSet .}}
Expand All @@ -197,6 +199,8 @@ func (data {{camelCase .Name}}) toBody(ctx context.Context) string {
} else {{end}}{{if and .DefaultValuePresent (not .ExcludeNull)}}if item.{{toGoName .TfName}}.IsNull() {
itemBody, _ = sjson.Set(itemBody, "{{range .DataPath}}{{.}}.{{end}}{{.ModelName}}.optionType", "default")
{{if or .DefaultValue .DefaultValueEmptyString}}itemBody, _ = sjson.Set(itemBody, "{{range .DataPath}}{{.}}.{{end}}{{.ModelName}}.value", {{if eq .Type "String"}}"{{end}}{{.DefaultValue}}{{if eq .Type "String"}}"{{end}}){{end}}
} else {{else if .AlwaysIncludeParent }}if data.{{toGoName .TfName}}.IsNull() {
body, _ = sjson.Set(body, path+"{{range .DataPath}}{{.}}.{{end}}optionType", "default")
} else {{else}}if !item.{{toGoName .TfName}}.IsNull(){{end}} {
itemBody, _ = sjson.Set(itemBody, "{{range .DataPath}}{{.}}.{{end}}{{.ModelName}}.optionType", "global")
{{- if isListSet .}}
Expand All @@ -223,6 +227,8 @@ func (data {{camelCase .Name}}) toBody(ctx context.Context) string {
} else {{end}}{{if and .DefaultValuePresent (not .ExcludeNull)}}if childItem.{{toGoName .TfName}}.IsNull() {
itemChildBody, _ = sjson.Set(itemChildBody, "{{range .DataPath}}{{.}}.{{end}}{{.ModelName}}.optionType", "default")
{{if or .DefaultValue .DefaultValueEmptyString}}itemChildBody, _ = sjson.Set(itemChildBody, "{{range .DataPath}}{{.}}.{{end}}{{.ModelName}}.value", {{if eq .Type "String"}}"{{end}}{{.DefaultValue}}{{if eq .Type "String"}}"{{end}}){{end}}
} else {{else if .AlwaysIncludeParent }}if data.{{toGoName .TfName}}.IsNull() {
body, _ = sjson.Set(body, path+"{{range .DataPath}}{{.}}.{{end}}optionType", "default")
} else {{else}}if !childItem.{{toGoName .TfName}}.IsNull(){{end}} {
itemChildBody, _ = sjson.Set(itemChildBody, "{{range .DataPath}}{{.}}.{{end}}{{.ModelName}}.optionType", "global")
{{- if isListSet .}}
Expand All @@ -249,6 +255,8 @@ func (data {{camelCase .Name}}) toBody(ctx context.Context) string {
} else {{end}}{{if and .DefaultValuePresent (not .ExcludeNull)}}if childChildItem.{{toGoName .TfName}}.IsNull() {
itemChildChildBody, _ = sjson.Set(itemChildChildBody, "{{range .DataPath}}{{.}}.{{end}}{{.ModelName}}.optionType", "default")
{{if or .DefaultValue .DefaultValueEmptyString}}itemChildChildBody, _ = sjson.Set(itemChildChildBody, "{{range .DataPath}}{{.}}.{{end}}{{.ModelName}}.value", {{if eq .Type "String"}}"{{end}}{{.DefaultValue}}{{if eq .Type "String"}}"{{end}}){{end}}
} else {{else if .AlwaysIncludeParent }}if data.{{toGoName .TfName}}.IsNull() {
body, _ = sjson.Set(body, path+"{{range .DataPath}}{{.}}.{{end}}optionType", "default")
} else {{else}}if !childChildItem.{{toGoName .TfName}}.IsNull(){{end}} {
itemChildChildBody, _ = sjson.Set(itemChildChildBody, "{{range .DataPath}}{{.}}.{{end}}{{.ModelName}}.optionType", "global")
{{- if isListSet .}}
Expand Down
18 changes: 9 additions & 9 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ toolchain go1.21.6

require (
github.com/hashicorp/terraform-plugin-docs v0.19.4
github.com/hashicorp/terraform-plugin-framework v1.10.0
github.com/hashicorp/terraform-plugin-framework v1.11.0
github.com/hashicorp/terraform-plugin-framework-validators v0.13.0
github.com/hashicorp/terraform-plugin-go v0.23.0
github.com/hashicorp/terraform-plugin-log v0.9.0
github.com/hashicorp/terraform-plugin-testing v1.9.0
github.com/netascode/go-sdwan v0.1.6
github.com/tidwall/gjson v1.17.1
github.com/tidwall/gjson v1.17.3
github.com/tidwall/sjson v1.2.5
golang.org/x/tools v0.23.0
golang.org/x/tools v0.24.0
gopkg.in/yaml.v3 v3.0.1
)

Expand Down Expand Up @@ -77,13 +77,13 @@ require (
github.com/yuin/goldmark-meta v1.1.0 // indirect
github.com/zclconf/go-cty v1.14.4 // indirect
go.abhg.dev/goldmark/frontmatter v0.2.0 // indirect
golang.org/x/crypto v0.25.0 // indirect
golang.org/x/crypto v0.26.0 // indirect
golang.org/x/exp v0.0.0-20230809150735-7b3493d9a819 // indirect
golang.org/x/mod v0.19.0 // indirect
golang.org/x/net v0.27.0 // indirect
golang.org/x/sync v0.7.0 // indirect
golang.org/x/sys v0.22.0 // indirect
golang.org/x/text v0.16.0 // indirect
golang.org/x/mod v0.20.0 // indirect
golang.org/x/net v0.28.0 // indirect
golang.org/x/sync v0.8.0 // indirect
golang.org/x/sys v0.23.0 // indirect
golang.org/x/text v0.17.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de // indirect
google.golang.org/grpc v1.63.2 // indirect
Expand Down
Loading

0 comments on commit 717b793

Please sign in to comment.