Skip to content

Commit

Permalink
azurerm_mssql_database|azurerm_mssql_managed_database - do not send l…
Browse files Browse the repository at this point in the history
…ong rendition values in payload unless set (#24124)
  • Loading branch information
katbyte authored Dec 7, 2023
1 parent 12e0a2a commit 81416af
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions internal/services/mssql/helper/sql_retention_policies.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,20 +113,20 @@ func ExpandLongTermRetentionPolicy(input []interface{}) *longtermretentionpolici
WeekOfYear: pointer.To(int64(1)),
}

if v, ok := policy["weekly_retention"]; ok {
output.WeeklyRetention = pointer.To(v.(string))
if v, ok := policy["weekly_retention"].(string); ok && v != "" {
output.WeeklyRetention = pointer.To(v)
}

if v, ok := policy["monthly_retention"]; ok {
output.MonthlyRetention = pointer.To(v.(string))
if v, ok := policy["monthly_retention"].(string); ok && v != "" {
output.MonthlyRetention = pointer.To(v)
}

if v, ok := policy["yearly_retention"]; ok {
output.YearlyRetention = pointer.To(v.(string))
if v, ok := policy["yearly_retention"].(string); ok && v != "" {
output.YearlyRetention = pointer.To(v)
}

if v, ok := policy["week_of_year"]; ok {
output.WeekOfYear = pointer.To(int64(v.(int)))
if v, ok := policy["week_of_year"].(int); ok && v != 0 {
output.WeekOfYear = pointer.To(int64(v))
}

return pointer.To(output)
Expand Down

0 comments on commit 81416af

Please sign in to comment.