diff --git a/examples/resources/okta_profile_mapping/import.sh b/examples/resources/okta_profile_mapping/import.sh deleted file mode 100644 index 2a1a638a3..000000000 --- a/examples/resources/okta_profile_mapping/import.sh +++ /dev/null @@ -1 +0,0 @@ -terraform import okta_profile_mapping.example <id> \ No newline at end of file diff --git a/okta/resource_okta_profile_mapping.go b/okta/resource_okta_profile_mapping.go index dd2658a18..9c8973608 100644 --- a/okta/resource_okta_profile_mapping.go +++ b/okta/resource_okta_profile_mapping.go @@ -74,9 +74,6 @@ func resourceProfileMapping() *schema.Resource { Default: false, }, }, - Importer: &schema.ResourceImporter{ - StateContext: schema.ImportStatePassthroughContext, - }, } } @@ -111,8 +108,7 @@ func resourceProfileMappingCreate(ctx context.Context, d *schema.ResourceData, m } d.SetId(mapping.Id) newMapping := buildMapping(d) - deleteWhenAbsent, ok := d.GetOk("delete_when_absent") - if ok && deleteWhenAbsent.(bool) { + if d.Get("delete_when_absent").(bool) { newMapping.Properties = mergeProperties(newMapping.Properties, getDeleteProperties(d, mapping.Properties)) } _, _, err = getOktaClientFromMetadata(m).ProfileMapping.UpdateProfileMapping(ctx, mapping.Id, newMapping) @@ -141,8 +137,7 @@ func resourceProfileMappingRead(ctx context.Context, d *schema.ResourceData, m i _ = d.Set("target_type", mapping.Target.Type) _ = d.Set("target_id", mapping.Target.Id) _ = d.Set("target_name", mapping.Target.Name) - deleteWhenAbsent, ok := d.GetOk("delete_when_absent") - if ok && !deleteWhenAbsent.(bool) { + if d.Get("delete_when_absent").(bool) { current := buildMappingProperties(d.Get("mappings").(*schema.Set)) for k := range mapping.Properties { if _, ok := current[k]; !ok { @@ -165,8 +160,7 @@ func resourceProfileMappingUpdate(ctx context.Context, d *schema.ResourceData, m return diag.Errorf("no profile mappings found for source ID '%s' and target ID '%s'", sourceID, targetID) } newMapping := buildMapping(d) - deleteWhenAbsent, ok := d.GetOk("delete_when_absent") - if ok && deleteWhenAbsent.(bool) { + if d.Get("delete_when_absent").(bool) { newMapping.Properties = mergeProperties(newMapping.Properties, getDeleteProperties(d, mapping.Properties)) } _, _, err = getOktaClientFromMetadata(m).ProfileMapping.UpdateProfileMapping(ctx, mapping.Id, newMapping)