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

Commit

Permalink
Rather then syncing index, just set it on import directly
Browse files Browse the repository at this point in the history
  • Loading branch information
quantumew committed Nov 20, 2019
1 parent 56570af commit 29b81c6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
5 changes: 4 additions & 1 deletion okta/resource_okta_user_base_schema.go
Expand Up @@ -15,7 +15,10 @@ func resourceUserBaseSchema() *schema.Resource {
Delete: resourceUserBaseSchemaDelete,
Exists: resourceUserBaseSchemaExists,
Importer: &schema.ResourceImporter{
State: schema.ImportStatePassthrough,
State: func(d *schema.ResourceData, m interface{}) ([]*schema.ResourceData, error) {
d.Set("index", d.Id())
return []*schema.ResourceData{d}, nil
},
},

Schema: userBaseSchemaSchema,
Expand Down
5 changes: 4 additions & 1 deletion okta/resource_okta_user_schema.go
Expand Up @@ -15,7 +15,10 @@ func resourceUserSchema() *schema.Resource {
Delete: resourceUserSchemaDelete,
Exists: resourceUserSchemaExists,
Importer: &schema.ResourceImporter{
State: schema.ImportStatePassthrough,
State: func(d *schema.ResourceData, m interface{}) ([]*schema.ResourceData, error) {
d.Set("index", d.Id())
return []*schema.ResourceData{d}, nil
},
},
Schema: userSchemaSchema,
}
Expand Down
4 changes: 0 additions & 4 deletions okta/user_schema.go
Expand Up @@ -189,8 +189,6 @@ func buildCustomUserSchema(target map[string]*schema.Schema) map[string]*schema.
}

func syncUserSchema(d *schema.ResourceData, subschema *sdk.UserSubSchema) error {
// Syncing it so it shows up in import plan
d.Set("index", d.Get("index").(string))
d.Set("title", subschema.Title)
d.Set("type", subschema.Type)
d.Set("description", subschema.Description)
Expand Down Expand Up @@ -219,8 +217,6 @@ func syncUserSchema(d *schema.ResourceData, subschema *sdk.UserSubSchema) error
}

func syncBaseUserSchema(d *schema.ResourceData, subschema *sdk.UserSubSchema) {
// Syncing it so it shows up in import plan
d.Set("index", d.Get("index").(string))
d.Set("title", subschema.Title)
d.Set("type", subschema.Type)
d.Set("required", subschema.Required)
Expand Down

0 comments on commit 29b81c6

Please sign in to comment.