okta / terraform-provider-okta

A Terraform provider to manage Okta resources, enabling infrastructure-as-code provisioning and management of users, groups, applications, and other Okta objects.
https://registry.terraform.io/providers/okta/okta
Mozilla Public License 2.0
253 stars 203 forks source link

Add support for different User Types to the `okta_user` resource #2002

Open jbaker10 opened 3 months ago

jbaker10 commented 3 months ago

Community Note

Description

Okta allows the creation of multiple different user types, not associated with the userType attribute typically used to delineate things like Employee vs Contingent Worker, but rather completely separate user types that have different profile schemas associated (Documentation here https://developer.okta.com/docs/reference/api/user-types/). Per the API docs, Okta API supports the ability to create new users and specify the user type by adding the "type" map to the request body. The terraform provider does not offer such support and throws the error Unexpected attribute: An attribute named "type" is not expected here when defining type on the okta_user resource.

An example use case is the creation of Service Accounts with a different user type and schema.

New or Affected Resource(s)

Potential Terraform Configuration

resource "okta_user" "jane_doe" {
  first_name = "Jane"
  last_name = "Doe"
  login = "jane.doe@acme.com"
  email = "jane.doe@acme.com"
  user_type = "Employee"
  type = {
    id = "oty50ejpg8RRdlrsz7v5"
  }
}

References

duytiennguyen-okta commented 3 months ago

OKTA internal reference https://oktainc.atlassian.net/browse/OKTA-735622