Skip to content

Commit

Permalink
Removed forceNew flag from resource_service_principal tags (#245)
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkDordoy committed May 14, 2020
1 parent 9ac410f commit d52535a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion azuread/resource_service_principal.go
Expand Up @@ -55,7 +55,6 @@ func resourceServicePrincipal() *schema.Resource {
"tags": {
Type: schema.TypeSet,
Optional: true,
ForceNew: true,
Set: schema.HashString,
Elem: &schema.Schema{
Type: schema.TypeString,
Expand Down Expand Up @@ -115,6 +114,15 @@ func resourceServicePrincipalUpdate(d *schema.ResourceData, meta interface{}) er
properties.AppRoleAssignmentRequired = p.Bool(d.Get("app_role_assignment_required").(bool))
}

if d.HasChange("tags") {
if v, ok := d.GetOk("tags"); ok {
properties.Tags = tf.ExpandStringSlicePtr(v.(*schema.Set).List())
} else {
empty := []string{} // clear tags with empty array
properties.Tags = &empty
}
}

if _, err := client.Update(ctx, d.Id(), properties); err != nil {
return fmt.Errorf("Error patching Azure AD Service Principal with ID %q: %+v", d.Id(), err)
}
Expand Down

0 comments on commit d52535a

Please sign in to comment.