Skip to content

Commit

Permalink
azuread_application: Scope/Role validation for magic string "User"
Browse files Browse the repository at this point in the history
  • Loading branch information
manicminer committed Mar 7, 2022
1 parent 10ec49b commit af740a7
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions internal/services/applications/validate/tokens.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package validate

import (
"fmt"
"regexp"
"strings"

"github.com/hashicorp/go-cty/cty"
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
Expand Down Expand Up @@ -44,5 +46,14 @@ func RoleScopeClaimValue(i interface{}, path cty.Path) (ret diag.Diagnostics) {
})
}

// See https://github.com/hashicorp/terraform-provider-azuread/issues/721
if strings.EqualFold(v, "User") {
ret = append(ret, diag.Diagnostic{
Severity: diag.Error,
Summary: fmt.Sprintf("Value cannot have the string value %q", "User"),
AttributePath: path,
})
}

return // nolint:nakedret
}

0 comments on commit af740a7

Please sign in to comment.