Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into policy-objects
Browse files Browse the repository at this point in the history
  • Loading branch information
seconroy committed Jul 18, 2024
2 parents 607219f + b35a25e commit 6d1e064
Show file tree
Hide file tree
Showing 70 changed files with 97 additions and 73 deletions.
10 changes: 7 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
## 0.3.13
## 0.3.14 (unreleased)

- Add workaround for issue when concurrently deleting security policy objects where the reference count is not updated
- BREAKING CHANGE: Remove default value of `failure_mode` attribute of `sdwan_security_policy` resource
- Fix issue when reading deleted `sdwan_cli_config_profile_parcel` resource, [link](https://github.com/CiscoDevNet/terraform-provider-sdwan/issues/291)
- Add `sdwan_policy_object_feature_profile` resource and data source
- Add `sdwan_policy_object_class_map_profile_parcel` resource and data source
- Add `sdwan_policy_object_color_list_profile_parcel` resource and data source
Expand All @@ -15,6 +14,11 @@
- Add `sdwan_policy_object_ipv4_prefix_list_profile_parcel` resource and data source
- Add `sdwan_policy_object_ipv6_prefix_list_profile_parcel` resource and data source

## 0.3.13

- Add workaround for issue when concurrently deleting security policy objects where the reference count is not updated
- BREAKING CHANGE: Remove default value of `failure_mode` attribute of `sdwan_security_policy` resource

## 0.3.12

- Add `protocol_type` attribute to `sdwan_zone_based_firewall_policy_definition` resource and data source
Expand Down
10 changes: 7 additions & 3 deletions docs/guides/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@ description: |-

# Changelog

## 0.3.13
## 0.3.14 (unreleased)

- Add workaround for issue when concurrently deleting security policy objects where the reference count is not updated
- BREAKING CHANGE: Remove default value of `failure_mode` attribute of `sdwan_security_policy` resource
- Fix issue when reading deleted `sdwan_cli_config_profile_parcel` resource, [link](https://github.com/CiscoDevNet/terraform-provider-sdwan/issues/291)
- Add `sdwan_policy_object_feature_profile` resource and data source
- Add `sdwan_policy_object_class_map_profile_parcel` resource and data source
- Add `sdwan_policy_object_color_list_profile_parcel` resource and data source
Expand All @@ -24,6 +23,11 @@ description: |-
- Add `sdwan_policy_object_ipv4_prefix_list_profile_parcel` resource and data source
- Add `sdwan_policy_object_ipv6_prefix_list_profile_parcel` resource and data source

## 0.3.13

- Add workaround for issue when concurrently deleting security policy objects where the reference count is not updated
- BREAKING CHANGE: Remove default value of `failure_mode` attribute of `sdwan_security_policy` resource

## 0.3.12

- Add `protocol_type` attribute to `sdwan_zone_based_firewall_policy_definition` resource and data source
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
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ func (r *AdvancedInspectionProfilePolicyDefinitionResource) Read(ctx context.Con
tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String()))

res, err := r.client.Get(state.getPath() + url.QueryEscape(state.Id.ValueString()))
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
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ func (r *AdvancedMalwareProtectionPolicyDefinitionResource) Read(ctx context.Con
tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String()))

res, err := r.client.Get(state.getPath() + url.QueryEscape(state.Id.ValueString()))
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
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ func (r *AllowURLListPolicyObjectResource) Read(ctx context.Context, req resourc
tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String()))

res, err := r.client.Get(state.getPath() + url.QueryEscape(state.Id.ValueString()))
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
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ func (r *AppProbeClassPolicyObjectResource) Read(ctx context.Context, req resour
tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String()))

res, err := r.client.Get(state.getPath() + url.QueryEscape(state.Id.ValueString()))
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
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ func (r *ApplicationAwareRoutingPolicyDefinitionResource) Read(ctx context.Conte
tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String()))

res, err := r.client.Get(state.getPath() + url.QueryEscape(state.Id.ValueString()))
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
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ func (r *ApplicationListPolicyObjectResource) Read(ctx context.Context, req reso
tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String()))

res, err := r.client.Get(state.getPath() + url.QueryEscape(state.Id.ValueString()))
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
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ func (r *ApplicationPriorityFeatureProfileResource) Read(ctx context.Context, re
tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String()))

res, err := r.client.Get(state.getPath() + url.QueryEscape(state.Id.ValueString()))
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
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ func (r *ASPathListPolicyObjectResource) Read(ctx context.Context, req resource.
tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String()))

res, err := r.client.Get(state.getPath() + url.QueryEscape(state.Id.ValueString()))
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
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ func (r *BlockURLListPolicyObjectResource) Read(ctx context.Context, req resourc
tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String()))

res, err := r.client.Get(state.getPath() + url.QueryEscape(state.Id.ValueString()))
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
2 changes: 1 addition & 1 deletion internal/provider/resource_sdwan_centralized_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ func (r *CentralizedPolicyResource) Read(ctx context.Context, req resource.ReadR
tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String()))

res, err := r.client.Get("/template/policy/vsmart/definition/" + url.QueryEscape(state.Id.ValueString()))
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
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ func (r *CflowdPolicyDefinitionResource) Read(ctx context.Context, req resource.
tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String()))

res, err := r.client.Get(state.getPath() + url.QueryEscape(state.Id.ValueString()))
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
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ func (r *ClassMapPolicyObjectResource) Read(ctx context.Context, req resource.Re
tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String()))

res, err := r.client.Get(state.getPath() + url.QueryEscape(state.Id.ValueString()))
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
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ func (r *CLIConfigProfileParcelResource) Read(ctx context.Context, req resource.
tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String()))

res, err := r.client.Get(state.getPath() + url.QueryEscape(state.Id.ValueString()))
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
2 changes: 1 addition & 1 deletion internal/provider/resource_sdwan_cli_device_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ func (r *CLIDeviceTemplateResource) Read(ctx context.Context, req resource.ReadR
tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String()))

res, err := r.client.Get("/template/device/object/" + url.QueryEscape(state.Id.ValueString()))
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
2 changes: 1 addition & 1 deletion internal/provider/resource_sdwan_cli_feature_profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ func (r *CLIFeatureProfileResource) Read(ctx context.Context, req resource.ReadR
tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String()))

res, err := r.client.Get(state.getPath() + url.QueryEscape(state.Id.ValueString()))
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
Loading

0 comments on commit 6d1e064

Please sign in to comment.