Skip to content

Commit

Permalink
moved ua-msi parsing as per review
Browse files Browse the repository at this point in the history
  • Loading branch information
jackofallops committed May 18, 2020
1 parent c8f7e5b commit 0ba2ccf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
5 changes: 2 additions & 3 deletions azurerm/internal/services/blueprints/validate/identity.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ package validate

import (
"fmt"

"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/msi/parse"
)

func UserAssignedIdentityId(i interface{}, k string) (warnings []string, errors []error) {
Expand All @@ -13,7 +12,7 @@ func UserAssignedIdentityId(i interface{}, k string) (warnings []string, errors
return
}

if _, err := azure.ParseUserAssignedIdentityID(v); err != nil {
if _, err := parse.UserAssignedIdentityID(v); err != nil {
errors = append(errors, fmt.Errorf("Can not parse %q as a resource id: %v", k, err))
return
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package azure
package parse

import "fmt"
import (
"fmt"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure"
)

type UserAssignedIdentityId struct {
// "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso-resource-group/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-identity"
Expand All @@ -9,12 +12,12 @@ type UserAssignedIdentityId struct {
Name string
}

func ParseUserAssignedIdentityID(input string) (*UserAssignedIdentityId, error) {
func UserAssignedIdentityID(input string) (*UserAssignedIdentityId, error) {
if len(input) == 0 {
return nil, fmt.Errorf("Bad: UserAssignedIdentityId cannot be an empty string")
}

id, err := ParseAzureResourceID(input)
id, err := azure.ParseAzureResourceID(input)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 0ba2ccf

Please sign in to comment.