Skip to content

Commit

Permalink
Tidy up, variable scoping
Browse files Browse the repository at this point in the history
  • Loading branch information
manicminer committed Sep 22, 2021
1 parent 58d170e commit ba06ff6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,7 @@ func appRoleAssignmentResourceCreate(ctx context.Context, d *schema.ResourceData
appRoleId := d.Get("app_role_id").(string)
principalId := d.Get("principal_object_id").(string)
resourceId := d.Get("resource_object_id").(string)
_, status, err := servicePrincipalsClient.Get(ctx, resourceId, odata.Query{})
if err != nil {
if _, status, err := servicePrincipalsClient.Get(ctx, resourceId, odata.Query{}); err != nil {
if status == http.StatusNotFound {
return tf.ErrorDiagPathF(err, "principal_object_id", "Service principal not found for resource (Object ID: %q)", resourceId)
}
Expand Down Expand Up @@ -175,8 +174,7 @@ func appRoleAssignmentResourceDelete(ctx context.Context, d *schema.ResourceData
return tf.ErrorDiagPathF(err, "id", "Parsing app role assignment with ID %q", d.Id())
}

status, err := client.Remove(ctx, id.ResourceId, id.AssignmentId)
if err != nil {
if status, err := client.Remove(ctx, id.ResourceId, id.AssignmentId); err != nil {
return tf.ErrorDiagPathF(err, "id", "Deleting app role assignment for resource %q with ID %q, got status %d", id.ResourceId, id.AssignmentId, status)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func (r AppRoleAssignmentResource) Exists(ctx context.Context, clients *clients.
}

if appRoleAssignments == nil {
return nil, fmt.Errorf("failed to retrieve App ROle Assignments for Resource with ID %q: appRoleAssignments was nil", id.ResourceId)
return nil, fmt.Errorf("failed to retrieve App Role Assignments for Resource with ID %q: appRoleAssignments was nil", id.ResourceId)
}

for _, assignment := range *appRoleAssignments {
Expand Down

0 comments on commit ba06ff6

Please sign in to comment.