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

Removed forceNew flag from resource_service_principal tags #245

Merged
merged 5 commits into from
May 14, 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
10 changes: 9 additions & 1 deletion azuread/resource_service_principal.go
Original file line number Diff line number Diff line change
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