Skip to content

Commit

Permalink
azurerm_backup_policy_file_share, azurerm_backup_policy_vm - fix …
Browse files Browse the repository at this point in the history
…a bug that `include_last_days` is not working when `days` is empty
  • Loading branch information
ms-henglu committed Mar 18, 2024
1 parent 7f80c0b commit 56dc532
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ func expandBackupProtectionPolicyFileShareRetentionMonthly(d *pluginsdk.Resource
scheduleFormat := protectionpolicies.RetentionScheduleFormatWeekly
var weekly *protectionpolicies.WeeklyRetentionFormat = nil
var daily *protectionpolicies.DailyRetentionFormat = nil
if v, ok := block["days"]; ok && v.(*pluginsdk.Set).Len() > 0 {
if v, ok := block["days"]; ok && v.(*pluginsdk.Set).Len() > 0 || block["include_last_days"].(bool) {
scheduleFormat = protectionpolicies.RetentionScheduleFormatDaily
daily = expandBackupProtectionPolicyFileShareRetentionDailyFormat(block)
} else {
Expand Down Expand Up @@ -357,7 +357,7 @@ func expandBackupProtectionPolicyFileShareRetentionYearly(d *pluginsdk.ResourceD
scheduleFormat := protectionpolicies.RetentionScheduleFormatWeekly
var weekly *protectionpolicies.WeeklyRetentionFormat = nil
var daily *protectionpolicies.DailyRetentionFormat = nil
if v, ok := block["days"]; ok && v.(*pluginsdk.Set).Len() > 0 {
if v, ok := block["days"]; ok && v.(*pluginsdk.Set).Len() > 0 || block["include_last_days"].(bool) {
scheduleFormat = protectionpolicies.RetentionScheduleFormatDaily
daily = expandBackupProtectionPolicyFileShareRetentionDailyFormat(block)
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ func expandBackupProtectionPolicyVMRetentionMonthly(d *pluginsdk.ResourceData, t
scheduleFormat := protectionpolicies.RetentionScheduleFormatWeekly
var weekly *protectionpolicies.WeeklyRetentionFormat = nil
var daily *protectionpolicies.DailyRetentionFormat = nil
if v, ok := block["days"]; ok && v.(*pluginsdk.Set).Len() > 0 {
if v, ok := block["days"]; ok && v.(*pluginsdk.Set).Len() > 0 || block["include_last_days"].(bool) {
scheduleFormat = protectionpolicies.RetentionScheduleFormatDaily
daily = expandBackupProtectionPolicyVMRetentionDailyFormat(block)
} else {
Expand Down Expand Up @@ -484,7 +484,7 @@ func expandBackupProtectionPolicyVMRetentionYearly(d *pluginsdk.ResourceData, ti
scheduleFormat := protectionpolicies.RetentionScheduleFormatWeekly
var weekly *protectionpolicies.WeeklyRetentionFormat = nil
var daily *protectionpolicies.DailyRetentionFormat = nil
if v, ok := block["days"]; ok && v.(*pluginsdk.Set).Len() > 0 {
if v, ok := block["days"]; ok && v.(*pluginsdk.Set).Len() > 0 || block["include_last_days"].(bool) {
scheduleFormat = protectionpolicies.RetentionScheduleFormatDaily
daily = expandBackupProtectionPolicyVMRetentionDailyFormat(block)
} else {
Expand Down

0 comments on commit 56dc532

Please sign in to comment.