Skip to content

Commit

Permalink
prevent force replacing resources when import value in state is nil
Browse files Browse the repository at this point in the history
Signed-off-by: Kyle Herock <kherock@gmail.com>
  • Loading branch information
kherock committed Jan 3, 2025
1 parent 46f35f6 commit 60c4586
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions provider/resource_keycloak_openid_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,10 @@ func resourceKeycloakOpenidClientRead(ctx context.Context, data *schema.Resource
return diag.FromErr(err)
}

if _, ok := data.GetOk("import"); !ok {
data.Set("import", false)
}

return nil
}

Expand Down
4 changes: 4 additions & 0 deletions provider/resource_keycloak_role.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,10 @@ func resourceKeycloakRoleRead(ctx context.Context, data *schema.ResourceData, me
data.Set("composite_roles", compositeRoleIds)
}

if _, ok := data.GetOk("import"); !ok {
data.Set("import", false)
}

return nil
}

Expand Down
4 changes: 4 additions & 0 deletions provider/resource_keycloak_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,10 @@ func resourceKeycloakUserRead(ctx context.Context, data *schema.ResourceData, me

mapFromUserToData(data, user)

if _, ok := data.GetOk("import"); !ok {
data.Set("import", false)
}

return nil
}

Expand Down

0 comments on commit 60c4586

Please sign in to comment.