Skip to content

Commit

Permalink
Merge pull request #7205 from terraform-providers/b/role-assignment-p…
Browse files Browse the repository at this point in the history
…reviews

r/role_assignment: support for assigning Preview roles
  • Loading branch information
tombuildsstuff committed Jun 4, 2020
2 parents 18af583 + f16c93e commit 0a9f976
Showing 1 changed file with 1 addition and 13 deletions.
Expand Up @@ -67,7 +67,7 @@ func resourceArmRoleAssignment() *schema.Resource {
ForceNew: true,
ConflictsWith: []string{"role_definition_id"},
DiffSuppressFunc: suppress.CaseDifference,
ValidateFunc: validateRoleDefinitionName,
ValidateFunc: validation.StringIsNotEmpty,
},

"principal_id": {
Expand Down Expand Up @@ -247,18 +247,6 @@ func resourceArmRoleAssignmentDelete(d *schema.ResourceData, meta interface{}) e
return nil
}

func validateRoleDefinitionName(i interface{}, k string) ([]string, []error) {
v, ok := i.(string)
if !ok {
return nil, []error{fmt.Errorf("expected type of %s to be string", k)}
}

if ok := strings.Contains(v, "(Preview)"); ok {
return nil, []error{fmt.Errorf("Preview roles are not supported")}
}
return nil, nil
}

func retryRoleAssignmentsClient(d *schema.ResourceData, scope string, name string, properties authorization.RoleAssignmentCreateParameters, meta interface{}) func() *resource.RetryError {
return func() *resource.RetryError {
roleAssignmentsClient := meta.(*clients.Client).Authorization.RoleAssignmentsClient
Expand Down

0 comments on commit 0a9f976

Please sign in to comment.