pulumi / pulumi-okta

An Okta Pulumi resource package, providing multi-language access to Okta
Apache License 2.0
9 stars 2 forks source link

UserType not properly assigned to a new user #388

Open albestia opened 11 months ago

albestia commented 11 months ago

What happened?

I've created a new userType with one new field and then try to create a new user of that type and fill in the custom field. Failing because of unknown field.

Pulumi output:

Diagnostics:
  okta:user:User (*****):
    error: 1 error occurred:
        * failed to create user: the API returned an error: Api validation failed: newUser. Causes: errorSummary: Property name 'customProperty' is not defined in profile

Example

        const customUserType = new okta.user.UserType("custom-user-profile", {
            name: "custom_user_profile",
            displayName: "Custom User Profile",
            description: "Custom User profile for specific User Fields"
        }, {
            parent: this,
        });

        const randomCustomProperty = new okta.UserSchemaProperty("random-custom-property", {
            index: "customProperty",
            title: "customProperty",
            type: "string",
            userType: customUserType.id,
        });

        const oktaUser = new okta.user.User(user.login, {
            login: user.login,
            email: user.email,
            firstName: user.firstName || user.login,
            lastName: user.lastName || user.login,
            status: "ACTIVE",
            password: user.password,
            // Custom fields
            userType: customUserType.id,
            customProfileAttributes: "{ \"customProperty\": \"customValue\" }",
        }, {
            parent: this,
            dependsOn: [randomCustomProperty]
        });

Output of pulumi about

CLI
Version 3.73.0 Go Version go1.20.5 Go Compiler gc

Plugins NAME VERSION nodejs unknown okta 4.4.0

Host
OS redhat Version 7.9 Arch x86_64

This project is written in nodejs: executable='/**/bin/node' version='v16.19.0'

Dependencies: NAME VERSION @types/node 16.18.34 js-yaml 4.1.0 @pulumi/okta 4.4.0 @pulumi/pulumi 3.74.0 @types/js-yaml 4.0.5

(Just avoid providing company private config information)

Additional context

I've also tried to create the users without providing the customProfileAttributes and then it is created but the user type is the default one; instead there's a new field in Okta user named "userType" with the ID set to it. Of course, there is no custom field on that newly created user.

Contributing

Vote on this issue by adding a 👍 reaction. To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

mikhailshilkov commented 11 months ago

Thank you for reporting @albestia. This definitely sounds like an upstream issue to me. It looks related to https://github.com/okta/terraform-provider-okta/issues/921 and https://github.com/okta/terraform-provider-okta/issues/921#issuecomment-1518264232. Unfortunately, that issue seems to be closed as stale without a fix :(