Resource: auth0_user_roles

With this resource, you can manage assigned roles for a user.

Example Usage

# Example:
resource "auth0_role" "admin" {
  name        = "admin"
  description = "Administrator"
}

resource "auth0_user" "user" {
  connection_name = "Username-Password-Authentication"
  username        = "unique_username"
  name            = "Firstname Lastname"
  email           = "test@test.com"
  password        = "passpass$12$12"

  # Until we remove the ability to operate changes on
  # the roles field it is important to have this
  # block in the config, to avoid diffing issues.
  lifecycle {
    ignore_changes = [roles]
  }
}

resource "auth0_user_roles" "user_roles" {
  user_id = auth0_user.user.id
  roles   = [auth0_role.admin.id]
}

Schema

Required

Read-Only

Import

Import is supported using the following syntax:

# This resource can be imported using the user ID.
#
# Example:
terraform import auth0_user_roles.user_roles "auth0|111111111111111111111111"