Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

azurerm_mssql_database - do not set longterm and shortterm retention policies when using the DW SKUs #8899

Merged
merged 1 commit into from
Oct 15, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions azurerm/internal/services/mssql/mssql_database_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ func resourceArmMsSqlDatabaseCreateUpdate(d *schema.ResourceData, meta interface
if longTermRetentionProps != nil {
longTermRetentionPolicy := sql.BackupLongTermRetentionPolicy{}

if !strings.HasPrefix(skuName.(string), "HS") {
if !strings.HasPrefix(skuName.(string), "HS") && !strings.HasPrefix(skuName.(string), "DW") {
longTermRetentionPolicy.LongTermRetentionPolicyProperties = longTermRetentionProps
}

Expand All @@ -471,7 +471,7 @@ func resourceArmMsSqlDatabaseCreateUpdate(d *schema.ResourceData, meta interface
if backupShortTermPolicyProps != nil {
backupShortTermPolicy := sql.BackupShortTermRetentionPolicy{}

if !strings.HasPrefix(skuName.(string), "HS") {
if !strings.HasPrefix(skuName.(string), "HS") && !strings.HasPrefix(skuName.(string), "DW") {
backupShortTermPolicy.BackupShortTermRetentionPolicyProperties = backupShortTermPolicyProps
}

Expand Down Expand Up @@ -563,7 +563,7 @@ func resourceArmMsSqlDatabaseRead(d *schema.ResourceData, meta interface{}) erro
}

// Hyper Scale SKU's do not currently support LRP and do not honour normal SRP operations
if !strings.HasPrefix(skuName, "HS") {
if !strings.HasPrefix(skuName, "HS") && !strings.HasPrefix(skuName, "DW") {
longTermPolicy, err := longTermRetentionClient.Get(ctx, id.ResourceGroup, id.MsSqlServer, id.Name)
if err != nil {
return fmt.Errorf("Error retrieving Long Term Policies for Database %q (Sql Server %q ;Resource Group %q): %+v", id.Name, id.MsSqlServer, id.ResourceGroup, err)
Expand All @@ -583,7 +583,7 @@ func resourceArmMsSqlDatabaseRead(d *schema.ResourceData, meta interface{}) erro
return fmt.Errorf("failure in setting `short_term_retention_policy`: %+v", err)
}
} else {
// HS SKUs need the retention policies zeroing for state consistency
// HS and DW SKUs need the retention policies zeroing for state consistency
zero := make([]interface{}, 0)
d.Set("long_term_retention_policy", zero)
d.Set("short_term_retention_policy", zero)
Expand Down