Skip to content
This repository has been archived by the owner on Jun 14, 2021. It is now read-only.

Commit

Permalink
Merge pull request #263 from articulate/feature/set-app-schema-scope
Browse files Browse the repository at this point in the history
Expose scope property on user schema
  • Loading branch information
quantumew committed Aug 27, 2019
2 parents db58a12 + 337f04a commit ccfd6ab
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions examples/okta_app_user_schema/updated.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ resource okta_app_user_schema test {
description = "terraform acceptance test updated"
required = true
master = "OKTA"
scope = "SELF"
}
1 change: 1 addition & 0 deletions okta/resource_app_user_schema_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ func TestAccAppUserSchemas_crud(t *testing.T) {
resource.TestCheckResourceAttr(resourceName, "description", "terraform acceptance test updated"),
resource.TestCheckResourceAttr(resourceName, "required", "true"),
resource.TestCheckResourceAttr(resourceName, "master", "OKTA"),
resource.TestCheckResourceAttr(resourceName, "scope", "SELF"),
),
},
},
Expand Down
8 changes: 8 additions & 0 deletions okta/user_schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ var (
Description: "Custom Subschema enumerated value of the property. see: developer.okta.com/docs/api/resources/schemas#user-profile-schema-property-object",
Elem: &schema.Schema{Type: schema.TypeString},
},
"scope": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Default: "NONE",
ValidateFunc: validation.StringInSlice([]string{"SELF", "NONE", ""}, false),
},
"one_of": &schema.Schema{
Type: schema.TypeList,
ForceNew: true,
Expand Down Expand Up @@ -154,6 +160,7 @@ func syncUserSchema(d *schema.ResourceData, subschema *sdk.UserSubSchema) error
d.Set("required", subschema.Required)
d.Set("min_length", subschema.MinLength)
d.Set("max_length", subschema.MaxLength)
d.Set("scope", subschema.Scope)

if subschema.Items != nil {
d.Set("array_type", subschema.Items.Type)
Expand Down Expand Up @@ -254,6 +261,7 @@ func getUserSubSchema(d *schema.ResourceData) *sdk.UserSubSchema {
Principal: "SELF",
},
},
Scope: d.Get("scope").(string),
Enum: convertInterfaceToStringArrNullable(d.Get("enum")),
Master: getNullableItem(d, "master"),
Items: getNullableItem(d, "array_type"),
Expand Down

0 comments on commit ccfd6ab

Please sign in to comment.