With this resource, you can manage assigned roles for a user.
# 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]
}
roles
(Set of String) Set of IDs of roles assigned to the user.user_id
(String) ID of the user.id
(String) The ID of this resource.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"