Skip to content

Commit e41d37a

Browse files
committed
Fix deployment of attached device templates without feature template changes
1 parent 394614d commit e41d37a

File tree

4 files changed

+25
-2
lines changed

4 files changed

+25
-2
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.2.6 (unreleased)
2+
3+
- Fix deployment of attached device templates without feature template changes
4+
15
## 0.2.5
26

37
- Add `sdwan_local_application_list_policy_object` resource and data source

docs/guides/changelog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ description: |-
77

88
# Changelog
99

10+
## 0.2.6 (unreleased)
11+
12+
- Fix deployment of attached device templates without feature template changes
13+
1014
## 0.2.5
1115

1216
- Add `sdwan_local_application_list_policy_object` resource and data source

internal/provider/resource_sdwan_attach_feature_device_template.go

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,18 +153,29 @@ func (r *AttachFeatureDeviceTemplateResource) Read(ctx context.Context, req reso
153153
}
154154

155155
func (r *AttachFeatureDeviceTemplateResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) {
156-
var plan AttachFeatureDeviceTemplate
156+
var plan, state AttachFeatureDeviceTemplate
157157

158158
// Read plan
159159
diags := req.Plan.Get(ctx, &plan)
160160
resp.Diagnostics.Append(diags...)
161161
if resp.Diagnostics.HasError() {
162162
return
163163
}
164+
// Read state
165+
diags = req.State.Get(ctx, &state)
166+
resp.Diagnostics.Append(diags...)
167+
if resp.Diagnostics.HasError() {
168+
return
169+
}
164170

165171
tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Update", plan.Id.ValueString()))
166172

167-
body, err := plan.toBody(ctx, r.client, true)
173+
edited := false
174+
if !plan.Version.Equal(state.Version) {
175+
edited = true
176+
}
177+
178+
body, err := plan.toBody(ctx, r.client, edited)
168179
if err != nil {
169180
resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to render body, got error: %s", err))
170181
return

templates/guides/changelog.md.tmpl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ description: |-
77

88
# Changelog
99

10+
## 0.2.6 (unreleased)
11+
12+
- Fix deployment of attached device templates without feature template changes
13+
1014
## 0.2.5
1115

1216
- Add `sdwan_local_application_list_policy_object` resource and data source

0 commit comments

Comments
 (0)