Skip to content

Commit

Permalink
ignoring deprecations of d.Partial
Browse files Browse the repository at this point in the history
  • Loading branch information
tombuildsstuff committed May 7, 2020
1 parent b6c6fbf commit 3542cb0
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -268,14 +268,14 @@ func resourceArmApiManagementService() *schema.Resource {
Type: schema.TypeList,
Optional: true,
Elem: &schema.Resource{
Schema: apiManagementResourceHostnameSchema("management"),
Schema: apiManagementResourceHostnameSchema(),
},
},
"portal": {
Type: schema.TypeList,
Optional: true,
Elem: &schema.Resource{
Schema: apiManagementResourceHostnameSchema("portal"),
Schema: apiManagementResourceHostnameSchema(),
},
},
"proxy": {
Expand All @@ -289,7 +289,7 @@ func resourceArmApiManagementService() *schema.Resource {
Type: schema.TypeList,
Optional: true,
Elem: &schema.Resource{
Schema: apiManagementResourceHostnameSchema("scm"),
Schema: apiManagementResourceHostnameSchema(),
},
},
},
Expand Down Expand Up @@ -989,6 +989,7 @@ func expandApiManagementCustomProperties(d *schema.ResourceData) map[string]*str
}

if vp := d.Get("protocols").([]interface{}); len(vp) > 0 {
// lintignore:SA1019 - this is a valid usage
if p, ok := d.GetOkExists("protocols.0.enable_http2"); ok {
customProperties[apimHttp2Protocol] = utils.String(strconv.FormatBool(p.(bool)))
}
Expand Down Expand Up @@ -1047,7 +1048,7 @@ func flattenApiManagementVirtualNetworkConfiguration(input *apimanagement.Virtua
return []interface{}{virtualNetworkConfiguration}
}

func apiManagementResourceHostnameSchema(schemaName string) map[string]*schema.Schema {
func apiManagementResourceHostnameSchema() map[string]*schema.Schema {
return map[string]*schema.Schema{
"host_name": {
Type: schema.TypeString,
Expand Down Expand Up @@ -1084,7 +1085,7 @@ func apiManagementResourceHostnameSchema(schemaName string) map[string]*schema.S
}

func apiManagementResourceHostnameProxySchema() map[string]*schema.Schema {
hostnameSchema := apiManagementResourceHostnameSchema("proxy")
hostnameSchema := apiManagementResourceHostnameSchema()

hostnameSchema["default_ssl_binding"] = &schema.Schema{
Type: schema.TypeBool,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@ func resourceArmKubernetesClusterNodePoolUpdate(d *schema.ResourceData, meta int
return err
}

// lintignore:SA1019 - necessary due to partial updates
d.Partial(true)

log.Printf("[DEBUG] Retrieving existing Node Pool %q (Kubernetes Cluster %q / Resource Group %q)..", id.Name, id.ClusterName, id.ResourceGroup)
Expand Down Expand Up @@ -424,6 +425,7 @@ func resourceArmKubernetesClusterNodePoolUpdate(d *schema.ResourceData, meta int
return fmt.Errorf("waiting for update of Node Pool %q (Kubernetes Cluster %q / Resource Group %q): %+v", id.Name, id.ClusterName, id.ResourceGroup, err)
}

// lintignore:SA1019 - necessary due to partial updates
d.Partial(false)

return resourceArmKubernetesClusterNodePoolRead(d, meta)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -688,6 +688,7 @@ func resourceArmKubernetesClusterUpdate(d *schema.ResourceData, meta interface{}
return err
}

// lintignore:SA1019 - necessary due to partial updates
d.Partial(true)

// we need to conditionally update the cluster
Expand Down Expand Up @@ -904,6 +905,7 @@ func resourceArmKubernetesClusterUpdate(d *schema.ResourceData, meta interface{}
log.Printf("[DEBUG] Upgraded the version of Kubernetes to %q..", kubernetesVersion)
}

// lintignore:SA1019 - necessary due to partial updates
d.Partial(false)

return resourceArmKubernetesClusterRead(d, meta)
Expand Down
2 changes: 2 additions & 0 deletions azurerm/internal/services/keyvault/key_vault_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ func resourceArmKeyVaultUpdate(d *schema.ResourceData, meta interface{}) error {
locks.ByName(name, keyVaultResourceName)
defer locks.UnlockByName(name, keyVaultResourceName)

// lintignore:SA1019
d.Partial(true)

// first pull the existing key vault since we need to lock on several bits of it's information
Expand Down Expand Up @@ -501,6 +502,7 @@ func resourceArmKeyVaultUpdate(d *schema.ResourceData, meta interface{}) error {
return fmt.Errorf("Error updating Key Vault %q (Resource Group %q): %+v", name, resourceGroup, err)
}

// lintignore:SA1019
d.Partial(false)

return resourceArmKeyVaultRead(d, meta)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -769,6 +769,7 @@ func resourceArmStorageAccountUpdate(d *schema.ResourceData, meta interface{}) e
}
}

// lintignore:SA1019 - necessary due to partial updates
d.Partial(true)

if d.HasChange("account_replication_type") {
Expand Down Expand Up @@ -941,6 +942,7 @@ func resourceArmStorageAccountUpdate(d *schema.ResourceData, meta interface{}) e
d.SetPartial("static_website")
}

// lintignore:SA1019 - necessary due to partial updates
d.Partial(false)
return resourceArmStorageAccountRead(d, meta)
}
Expand Down

0 comments on commit 3542cb0

Please sign in to comment.