Resource: auth0_user_role

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_role" "user_roles" {
  user_id = auth0_user.user.id
  role_id = auth0_role.admin.id
}

Schema

Required

Read-Only

Import

Import is supported using the following syntax:

# This resource can be imported by specifying the
# user ID and role ID separated by "::" (note the double colon)
# <userID>::<roleID>
#
# Example:
terraform import auth0_user_role.user_role "auth0|111111111111111111111111::role_123"