Skip to content

Commit

Permalink
Merge pull request #4738 from terraform-providers/b-msi-crash
Browse files Browse the repository at this point in the history
Bug Fix: Fix crash when using MSI Authentication
  • Loading branch information
tombuildsstuff authored Oct 28, 2019
2 parents cb9175b + f51339d commit 07be6c0
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions azurerm/data_source_client_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,17 @@ func dataSourceArmClientConfigRead(d *schema.ResourceData, meta interface{}) err
}

d.Set("object_id", "")
if v, err := client.getAuthenticatedObjectID(ctx); err != nil {
return fmt.Errorf("Error getting authenticated object ID: %v", err)
} else {
d.Set("object_id", v)

// TODO remove this when we confirm that MSI no longer returns nil with getAuthenticatedObjectID
objectId := ""
if client.getAuthenticatedObjectID != nil {
v, err := client.getAuthenticatedObjectID(ctx)
if err != nil {
return fmt.Errorf("Error getting authenticated object ID: %v", err)
}
objectId = v
}
d.Set("object_id", objectId)

return nil
}

0 comments on commit 07be6c0

Please sign in to comment.