diff --git a/internal/auth0/user/resource_roles.go b/internal/auth0/user/resource_roles.go index 8ef5bf048..ee9360dca 100644 --- a/internal/auth0/user/resource_roles.go +++ b/internal/auth0/user/resource_roles.go @@ -6,13 +6,14 @@ import ( "github.com/auth0/go-auth0" "github.com/auth0/go-auth0/management" + "github.com/hashicorp/go-multierror" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/auth0/terraform-provider-auth0/internal/config" ) -// NewRolesResource will returns a new auth0_user_roles (1:many) resource. +// NewRolesResource will return a new auth0_user_roles (1:many) resource. func NewRolesResource() *schema.Resource { return &schema.Resource{ Schema: map[string]*schema.Schema{ @@ -63,9 +64,7 @@ func upsertUserRoles(ctx context.Context, data *schema.ResourceData, meta interf func readUserRoles(_ context.Context, data *schema.ResourceData, meta interface{}) diag.Diagnostics { api := meta.(*config.Config).GetAPI() - userID := data.Get("user_id").(string) - - rolesList, err := api.User.Roles(userID) + rolesList, err := api.User.Roles(data.Id()) if err != nil { if mErr, ok := err.(management.Error); ok && mErr.Status() == http.StatusNotFound { data.SetId("") @@ -80,11 +79,12 @@ func readUserRoles(_ context.Context, data *schema.ResourceData, meta interface{ userRoles = append(userRoles, role.GetID()) } - if err := data.Set("roles", userRoles); err != nil { - return diag.FromErr(err) - } + result := multierror.Append( + data.Set("user_id", data.Id()), + data.Set("roles", userRoles), + ) - return nil + return diag.FromErr(result.ErrorOrNil()) } func deleteUserRoles(_ context.Context, data *schema.ResourceData, meta interface{}) diag.Diagnostics { diff --git a/internal/auth0/user/resource_roles_test.go b/internal/auth0/user/resource_roles_test.go index 542d38eeb..824a6ab3b 100644 --- a/internal/auth0/user/resource_roles_test.go +++ b/internal/auth0/user/resource_roles_test.go @@ -1,10 +1,12 @@ package user_test import ( + "os" "strings" "testing" "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/plancheck" "github.com/auth0/terraform-provider-auth0/internal/acctest" ) @@ -153,3 +155,87 @@ func TestAccUserRoles(t *testing.T) { }, }) } + +const testAccUserRolesImport = ` +resource auth0_role owner { + name = "owner" + description = "Owner" +} + +resource auth0_role admin { + name = "admin" + description = "Administrator" +} + +resource auth0_user user { + depends_on = [auth0_role.owner, auth0_role.admin] + + connection_name = "Username-Password-Authentication" + email = "{{.testName}}@acceptance.test.com" + password = "passpass$12$12" + + lifecycle { + ignore_changes = [ roles, connection_name, password ] + } +} + +resource auth0_user_roles user_roles { + depends_on = [ auth0_user.user ] + + user_id = auth0_user.user.id + roles = [ auth0_role.owner.id, auth0_role.admin.id ] +} +` + +func TestAccUserRolesImport(t *testing.T) { + if os.Getenv("AUTH0_DOMAIN") != acctest.RecordingsDomain { + // The test runs only with recordings as it requires an initial setup. + t.Skip() + } + + testName := strings.ToLower(t.Name()) + + acctest.Test(t, resource.TestCase{ + Steps: []resource.TestStep{ + { + Config: acctest.ParseTestName(testAccUserRolesImport, testName), + ResourceName: "auth0_role.owner", + ImportState: true, + ImportStateId: "rol_XLLMqPwfx8kdG63e", + ImportStatePersist: true, + }, + { + Config: acctest.ParseTestName(testAccUserRolesImport, testName), + ResourceName: "auth0_role.admin", + ImportState: true, + ImportStateId: "rol_LjLyGzVZE5K34IaY", + ImportStatePersist: true, + }, + { + Config: acctest.ParseTestName(testAccUserRolesImport, testName), + ResourceName: "auth0_user.user", + ImportState: true, + ImportStateId: "auth0|646cbae1e37ebde3a5ad6fd0", + ImportStatePersist: true, + }, + { + Config: acctest.ParseTestName(testAccUserRolesImport, testName), + ResourceName: "auth0_user_roles.user_roles", + ImportState: true, + ImportStateId: "auth0|646cbae1e37ebde3a5ad6fd0", + ImportStatePersist: true, + }, + { + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectEmptyPlan(), + }, + }, + Config: acctest.ParseTestName(testAccUserRolesImport, testName), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr("auth0_user_roles.user_roles", "roles.#", "2"), + ), + }, + }, + }) +} diff --git a/test/data/recordings/TestAccUserRolesImport.yaml b/test/data/recordings/TestAccUserRolesImport.yaml new file mode 100644 index 000000000..67df9d861 --- /dev/null +++ b/test/data/recordings/TestAccUserRolesImport.yaml @@ -0,0 +1,1010 @@ +--- +version: 2 +interactions: + - id: 0 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 5 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: | + null + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0-SDK/0.17.2 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/roles/rol_XLLMqPwfx8kdG63e + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"rol_XLLMqPwfx8kdG63e","name":"owner","description":"Owner"}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 97.010834ms + - id: 1 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 5 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: | + null + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0-SDK/0.17.2 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/roles/rol_XLLMqPwfx8kdG63e/permissions?include_totals=true&page=0&per_page=50 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"permissions":[],"start":0,"limit":50,"total":0}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 124.828ms + - id: 2 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 5 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: | + null + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0-SDK/0.17.2 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/roles/rol_LjLyGzVZE5K34IaY + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"rol_LjLyGzVZE5K34IaY","name":"admin","description":"Administrator"}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 99.604083ms + - id: 3 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 5 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: | + null + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0-SDK/0.17.2 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/roles/rol_LjLyGzVZE5K34IaY/permissions?include_totals=true&page=0&per_page=50 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"permissions":[],"start":0,"limit":50,"total":0}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 95.129833ms + - id: 4 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 5 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: | + null + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0-SDK/0.17.2 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/users/auth0%7C646cbae1e37ebde3a5ad6fd0 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"created_at":"2023-05-23T13:08:49.444Z","email":"testaccuserrolesimport@acceptance.test.com","email_verified":false,"identities":[{"connection":"Username-Password-Authentication","user_id":"646cbae1e37ebde3a5ad6fd0","provider":"auth0","isSocial":false}],"name":"testaccuserrolesimport@acceptance.test.com","nickname":"testaccuserrolesimport","picture":"https://s.gravatar.com/avatar/1787f23058f222441a28bb5d49ee39d2?s=480&r=pg&d=https%3A%2F%2Fcdn.auth0.com%2Favatars%2Fte.png","updated_at":"2023-05-23T13:08:49.444Z","user_id":"auth0|646cbae1e37ebde3a5ad6fd0"}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 129.777459ms + - id: 5 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 5 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: | + null + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0-SDK/0.17.2 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/users/auth0%7C646cbae1e37ebde3a5ad6fd0/roles?include_totals=true&per_page=50 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"roles":[{"id":"rol_LjLyGzVZE5K34IaY","name":"admin","description":"Administrator"},{"id":"rol_XLLMqPwfx8kdG63e","name":"owner","description":"Owner"}],"start":0,"limit":50,"total":2}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 92.580958ms + - id: 6 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 5 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: | + null + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0-SDK/0.17.2 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/users/auth0%7C646cbae1e37ebde3a5ad6fd0/permissions?include_totals=true&per_page=50 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"permissions":[],"start":0,"limit":50,"total":0}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 229.191583ms + - id: 7 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 5 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: | + null + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0-SDK/0.17.2 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/users/auth0%7C646cbae1e37ebde3a5ad6fd0/roles?include_totals=true&per_page=50 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"roles":[{"id":"rol_LjLyGzVZE5K34IaY","name":"admin","description":"Administrator"},{"id":"rol_XLLMqPwfx8kdG63e","name":"owner","description":"Owner"}],"start":0,"limit":50,"total":2}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 96.148792ms + - id: 8 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 5 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: | + null + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0-SDK/0.17.2 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/roles/rol_XLLMqPwfx8kdG63e + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"rol_XLLMqPwfx8kdG63e","name":"owner","description":"Owner"}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 110.991542ms + - id: 9 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 5 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: | + null + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0-SDK/0.17.2 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/roles/rol_LjLyGzVZE5K34IaY + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"rol_LjLyGzVZE5K34IaY","name":"admin","description":"Administrator"}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 130.3925ms + - id: 10 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 5 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: | + null + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0-SDK/0.17.2 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/roles/rol_XLLMqPwfx8kdG63e/permissions?include_totals=true&page=0&per_page=50 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"permissions":[],"start":0,"limit":50,"total":0}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 99.365875ms + - id: 11 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 5 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: | + null + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0-SDK/0.17.2 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/roles/rol_LjLyGzVZE5K34IaY/permissions?include_totals=true&page=0&per_page=50 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"permissions":[],"start":0,"limit":50,"total":0}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 125.394625ms + - id: 12 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 5 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: | + null + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0-SDK/0.17.2 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/users/auth0%7C646cbae1e37ebde3a5ad6fd0 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"created_at":"2023-05-23T13:08:49.444Z","email":"testaccuserrolesimport@acceptance.test.com","email_verified":false,"identities":[{"connection":"Username-Password-Authentication","user_id":"646cbae1e37ebde3a5ad6fd0","provider":"auth0","isSocial":false}],"name":"testaccuserrolesimport@acceptance.test.com","nickname":"testaccuserrolesimport","picture":"https://s.gravatar.com/avatar/1787f23058f222441a28bb5d49ee39d2?s=480&r=pg&d=https%3A%2F%2Fcdn.auth0.com%2Favatars%2Fte.png","updated_at":"2023-05-23T13:08:49.444Z","user_id":"auth0|646cbae1e37ebde3a5ad6fd0"}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 97.105875ms + - id: 13 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 5 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: | + null + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0-SDK/0.17.2 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/users/auth0%7C646cbae1e37ebde3a5ad6fd0/roles?include_totals=true&per_page=50 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"roles":[{"id":"rol_LjLyGzVZE5K34IaY","name":"admin","description":"Administrator"},{"id":"rol_XLLMqPwfx8kdG63e","name":"owner","description":"Owner"}],"start":0,"limit":50,"total":2}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 116.411208ms + - id: 14 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 5 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: | + null + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0-SDK/0.17.2 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/users/auth0%7C646cbae1e37ebde3a5ad6fd0/permissions?include_totals=true&per_page=50 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"permissions":[],"start":0,"limit":50,"total":0}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 121.563375ms + - id: 15 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 5 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: | + null + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0-SDK/0.17.2 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/users/auth0%7C646cbae1e37ebde3a5ad6fd0/roles?include_totals=true&per_page=50 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"roles":[{"id":"rol_LjLyGzVZE5K34IaY","name":"admin","description":"Administrator"},{"id":"rol_XLLMqPwfx8kdG63e","name":"owner","description":"Owner"}],"start":0,"limit":50,"total":2}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 101.226959ms + - id: 16 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 5 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: | + null + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0-SDK/0.17.2 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/roles/rol_LjLyGzVZE5K34IaY + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"rol_LjLyGzVZE5K34IaY","name":"admin","description":"Administrator"}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 86.320417ms + - id: 17 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 5 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: | + null + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0-SDK/0.17.2 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/roles/rol_XLLMqPwfx8kdG63e + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"rol_XLLMqPwfx8kdG63e","name":"owner","description":"Owner"}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 142.127375ms + - id: 18 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 5 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: | + null + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0-SDK/0.17.2 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/roles/rol_XLLMqPwfx8kdG63e/permissions?include_totals=true&page=0&per_page=50 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"permissions":[],"start":0,"limit":50,"total":0}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 93.814875ms + - id: 19 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 5 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: | + null + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0-SDK/0.17.2 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/roles/rol_LjLyGzVZE5K34IaY/permissions?include_totals=true&page=0&per_page=50 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"permissions":[],"start":0,"limit":50,"total":0}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 116.117042ms + - id: 20 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 5 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: | + null + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0-SDK/0.17.2 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/users/auth0%7C646cbae1e37ebde3a5ad6fd0 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"created_at":"2023-05-23T13:08:49.444Z","email":"testaccuserrolesimport@acceptance.test.com","email_verified":false,"identities":[{"connection":"Username-Password-Authentication","user_id":"646cbae1e37ebde3a5ad6fd0","provider":"auth0","isSocial":false}],"name":"testaccuserrolesimport@acceptance.test.com","nickname":"testaccuserrolesimport","picture":"https://s.gravatar.com/avatar/1787f23058f222441a28bb5d49ee39d2?s=480&r=pg&d=https%3A%2F%2Fcdn.auth0.com%2Favatars%2Fte.png","updated_at":"2023-05-23T13:08:49.444Z","user_id":"auth0|646cbae1e37ebde3a5ad6fd0"}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 98.55025ms + - id: 21 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 5 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: | + null + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0-SDK/0.17.2 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/users/auth0%7C646cbae1e37ebde3a5ad6fd0/roles?include_totals=true&per_page=50 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"roles":[{"id":"rol_LjLyGzVZE5K34IaY","name":"admin","description":"Administrator"},{"id":"rol_XLLMqPwfx8kdG63e","name":"owner","description":"Owner"}],"start":0,"limit":50,"total":2}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 111.005375ms + - id: 22 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 5 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: | + null + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0-SDK/0.17.2 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/users/auth0%7C646cbae1e37ebde3a5ad6fd0/permissions?include_totals=true&per_page=50 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"permissions":[],"start":0,"limit":50,"total":0}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 105.340959ms + - id: 23 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 5 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: | + null + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0-SDK/0.17.2 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/users/auth0%7C646cbae1e37ebde3a5ad6fd0/roles?include_totals=true&per_page=50 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"roles":[{"id":"rol_LjLyGzVZE5K34IaY","name":"admin","description":"Administrator"},{"id":"rol_XLLMqPwfx8kdG63e","name":"owner","description":"Owner"}],"start":0,"limit":50,"total":2}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 277.517083ms + - id: 24 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 58 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: | + {"roles":["rol_LjLyGzVZE5K34IaY","rol_XLLMqPwfx8kdG63e"]} + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0-SDK/0.17.2 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/users/auth0%7C646cbae1e37ebde3a5ad6fd0/roles + method: DELETE + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 0 + uncompressed: false + body: "" + headers: + Content-Type: + - application/json; charset=utf-8 + status: 204 No Content + code: 204 + duration: 86.888666ms + - id: 25 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0-SDK/0.17.2 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/users/auth0%7C646cbae1e37ebde3a5ad6fd0 + method: DELETE + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 0 + uncompressed: false + body: "" + headers: + Content-Type: + - application/json; charset=utf-8 + status: 204 No Content + code: 204 + duration: 120.85125ms + - id: 26 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 3 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: | + {} + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0-SDK/0.17.2 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/roles/rol_LjLyGzVZE5K34IaY + method: DELETE + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 2 + uncompressed: false + body: '{}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 99.279708ms + - id: 27 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 3 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: | + {} + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0-SDK/0.17.2 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/roles/rol_XLLMqPwfx8kdG63e + method: DELETE + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 2 + uncompressed: false + body: '{}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 114.932541ms