From b6c3f9e7e436395b16337c0bf39d8e36f88bd9f5 Mon Sep 17 00:00:00 2001 From: Sergiu Ghitea <28300158+sergiught@users.noreply.github.com> Date: Tue, 23 May 2023 14:10:54 +0200 Subject: [PATCH] Fix import issue on auth0_user_permissions --- internal/auth0/user/resource_permissions.go | 12 +- .../auth0/user/resource_permissions_test.go | 93 +++ .../TestAccUserPermissionsImport.yaml | 685 ++++++++++++++++++ 3 files changed, 785 insertions(+), 5 deletions(-) create mode 100644 test/data/recordings/TestAccUserPermissionsImport.yaml diff --git a/internal/auth0/user/resource_permissions.go b/internal/auth0/user/resource_permissions.go index dd90f63dd..2eea0d396 100644 --- a/internal/auth0/user/resource_permissions.go +++ b/internal/auth0/user/resource_permissions.go @@ -6,6 +6,7 @@ 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" @@ -117,9 +118,7 @@ func upsertUserPermissions(ctx context.Context, data *schema.ResourceData, meta func readUserPermissions(_ context.Context, data *schema.ResourceData, meta interface{}) diag.Diagnostics { api := meta.(*config.Config).GetAPI() - userID := data.Get("user_id").(string) - - permissions, err := api.User.Permissions(userID) + permissions, err := api.User.Permissions(data.Id()) if err != nil { if mErr, ok := err.(management.Error); ok && mErr.Status() == http.StatusNotFound { data.SetId("") @@ -128,9 +127,12 @@ func readUserPermissions(_ context.Context, data *schema.ResourceData, meta inte return diag.FromErr(err) } - err = data.Set("permissions", flattenUserPermissions(permissions)) + result := multierror.Append( + data.Set("user_id", data.Id()), + data.Set("permissions", flattenUserPermissions(permissions)), + ) - return diag.FromErr(err) + return diag.FromErr(result.ErrorOrNil()) } func deleteUserPermissions(_ context.Context, data *schema.ResourceData, meta interface{}) diag.Diagnostics { diff --git a/internal/auth0/user/resource_permissions_test.go b/internal/auth0/user/resource_permissions_test.go index 5ce78f219..347731f05 100644 --- a/internal/auth0/user/resource_permissions_test.go +++ b/internal/auth0/user/resource_permissions_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" ) @@ -111,3 +113,94 @@ func TestAccUserPermissions(t *testing.T) { }, }) } + +const testAccUserPermissionsImport = ` +resource "auth0_resource_server" "resource_server" { + name = "Acceptance Test - {{.testName}}" + identifier = "https://uat.api.terraform-provider-auth0.com/{{.testName}}" + + scopes { + value = "read:foo" + description = "Can read Foo" + } + + scopes { + value = "create:foo" + description = "Can create Foo" + } +} + +resource "auth0_user" "user" { + depends_on = [ auth0_resource_server.resource_server ] + + connection_name = "Username-Password-Authentication" + password = "passpass$12$12" + email = "{{.testName}}@acceptance.test.com" + + lifecycle { + ignore_changes = [ connection_name, password ] + } +} + +resource "auth0_user_permissions" "user_permissions" { + depends_on = [ auth0_resource_server.resource_server, auth0_user.user ] + + user_id = auth0_user.user.id + + permissions { + resource_server_identifier = auth0_resource_server.resource_server.identifier + name = "read:foo" + } + + permissions { + resource_server_identifier = auth0_resource_server.resource_server.identifier + name = "create:foo" + } +} +` + +func TestAccUserPermissionsImport(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(testAccUserPermissionsImport, testName), + ResourceName: "auth0_resource_server.resource_server", + ImportState: true, + ImportStateId: "646cad063390a55e156ee4cd", + ImportStatePersist: true, + }, + { + Config: acctest.ParseTestName(testAccUserPermissionsImport, testName), + ResourceName: "auth0_user.user", + ImportState: true, + ImportStateId: "auth0|646cad06363aac78e30fc478", + ImportStatePersist: true, + }, + { + Config: acctest.ParseTestName(testAccUserPermissionsImport, testName), + ResourceName: "auth0_user_permissions.user_permissions", + ImportState: true, + ImportStateId: "auth0|646cad06363aac78e30fc478", + ImportStatePersist: true, + }, + { + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectEmptyPlan(), + }, + }, + Config: acctest.ParseTestName(testAccUserPermissionsImport, testName), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr("auth0_user_permissions.user_permissions", "permissions.#", "2"), + ), + }, + }, + }) +} diff --git a/test/data/recordings/TestAccUserPermissionsImport.yaml b/test/data/recordings/TestAccUserPermissionsImport.yaml new file mode 100644 index 000000000..0a4087c58 --- /dev/null +++ b/test/data/recordings/TestAccUserPermissionsImport.yaml @@ -0,0 +1,685 @@ +--- +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/resource-servers/646cad063390a55e156ee4cd + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"646cad063390a55e156ee4cd","name":"Acceptance Test - testaccuserpermissionsimport","identifier":"https://uat.api.terraform-provider-auth0.com/testaccuserpermissionsimport","allow_offline_access":false,"skip_consent_for_verifiable_first_party_clients":false,"token_lifetime":86400,"token_lifetime_for_web":7200,"signing_alg":"RS256","scopes":[{"value":"create:foo","description":"Can create Foo"},{"value":"read:foo","description":"Can read Foo"}]}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 110.0405ms + - 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/users/auth0%7C646cad06363aac78e30fc478 + 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-23T12:09:42.690Z","email":"testaccuserpermissionsimport@acceptance.test.com","email_verified":false,"identities":[{"connection":"Username-Password-Authentication","user_id":"646cad06363aac78e30fc478","provider":"auth0","isSocial":false}],"name":"testaccuserpermissionsimport@acceptance.test.com","nickname":"testaccuserpermissionsimport","picture":"https://s.gravatar.com/avatar/39316dfffecd747d8943eac17de89b23?s=480&r=pg&d=https%3A%2F%2Fcdn.auth0.com%2Favatars%2Fte.png","updated_at":"2023-05-23T12:09:42.690Z","user_id":"auth0|646cad06363aac78e30fc478"}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 123.715542ms + - 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/users/auth0%7C646cad06363aac78e30fc478/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":[],"start":0,"limit":50,"total":0}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 123.142875ms + - 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/users/auth0%7C646cad06363aac78e30fc478/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":[{"permission_name":"create:foo","description":"Can create Foo","resource_server_name":"Acceptance Test - testaccuserpermissionsimport","resource_server_identifier":"https://uat.api.terraform-provider-auth0.com/testaccuserpermissionsimport","sources":[{"source_id":"","source_name":"","source_type":"DIRECT"}]},{"permission_name":"read:foo","description":"Can read Foo","resource_server_name":"Acceptance Test - testaccuserpermissionsimport","resource_server_identifier":"https://uat.api.terraform-provider-auth0.com/testaccuserpermissionsimport","sources":[{"source_id":"","source_name":"","source_type":"DIRECT"}]}],"start":0,"limit":50,"total":2}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 108.494ms + - 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%7C646cad06363aac78e30fc478/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":[{"permission_name":"create:foo","description":"Can create Foo","resource_server_name":"Acceptance Test - testaccuserpermissionsimport","resource_server_identifier":"https://uat.api.terraform-provider-auth0.com/testaccuserpermissionsimport","sources":[{"source_id":"","source_name":"","source_type":"DIRECT"}]},{"permission_name":"read:foo","description":"Can read Foo","resource_server_name":"Acceptance Test - testaccuserpermissionsimport","resource_server_identifier":"https://uat.api.terraform-provider-auth0.com/testaccuserpermissionsimport","sources":[{"source_id":"","source_name":"","source_type":"DIRECT"}]}],"start":0,"limit":50,"total":2}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 115.199375ms + - 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/resource-servers/646cad063390a55e156ee4cd + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"646cad063390a55e156ee4cd","name":"Acceptance Test - testaccuserpermissionsimport","identifier":"https://uat.api.terraform-provider-auth0.com/testaccuserpermissionsimport","allow_offline_access":false,"skip_consent_for_verifiable_first_party_clients":false,"token_lifetime":86400,"token_lifetime_for_web":7200,"signing_alg":"RS256","scopes":[{"value":"create:foo","description":"Can create Foo"},{"value":"read:foo","description":"Can read Foo"}]}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 103.856417ms + - 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%7C646cad06363aac78e30fc478 + 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-23T12:09:42.690Z","email":"testaccuserpermissionsimport@acceptance.test.com","email_verified":false,"identities":[{"connection":"Username-Password-Authentication","user_id":"646cad06363aac78e30fc478","provider":"auth0","isSocial":false}],"name":"testaccuserpermissionsimport@acceptance.test.com","nickname":"testaccuserpermissionsimport","picture":"https://s.gravatar.com/avatar/39316dfffecd747d8943eac17de89b23?s=480&r=pg&d=https%3A%2F%2Fcdn.auth0.com%2Favatars%2Fte.png","updated_at":"2023-05-23T12:09:42.690Z","user_id":"auth0|646cad06363aac78e30fc478"}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 105.281791ms + - 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%7C646cad06363aac78e30fc478/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":[],"start":0,"limit":50,"total":0}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 87.041667ms + - 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/users/auth0%7C646cad06363aac78e30fc478/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":[{"permission_name":"create:foo","description":"Can create Foo","resource_server_name":"Acceptance Test - testaccuserpermissionsimport","resource_server_identifier":"https://uat.api.terraform-provider-auth0.com/testaccuserpermissionsimport","sources":[{"source_id":"","source_name":"","source_type":"DIRECT"}]},{"permission_name":"read:foo","description":"Can read Foo","resource_server_name":"Acceptance Test - testaccuserpermissionsimport","resource_server_identifier":"https://uat.api.terraform-provider-auth0.com/testaccuserpermissionsimport","sources":[{"source_id":"","source_name":"","source_type":"DIRECT"}]}],"start":0,"limit":50,"total":2}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 99.375042ms + - 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/users/auth0%7C646cad06363aac78e30fc478/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":[{"permission_name":"create:foo","description":"Can create Foo","resource_server_name":"Acceptance Test - testaccuserpermissionsimport","resource_server_identifier":"https://uat.api.terraform-provider-auth0.com/testaccuserpermissionsimport","sources":[{"source_id":"","source_name":"","source_type":"DIRECT"}]},{"permission_name":"read:foo","description":"Can read Foo","resource_server_name":"Acceptance Test - testaccuserpermissionsimport","resource_server_identifier":"https://uat.api.terraform-provider-auth0.com/testaccuserpermissionsimport","sources":[{"source_id":"","source_name":"","source_type":"DIRECT"}]}],"start":0,"limit":50,"total":2}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 102.27125ms + - 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/resource-servers/646cad063390a55e156ee4cd + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"646cad063390a55e156ee4cd","name":"Acceptance Test - testaccuserpermissionsimport","identifier":"https://uat.api.terraform-provider-auth0.com/testaccuserpermissionsimport","allow_offline_access":false,"skip_consent_for_verifiable_first_party_clients":false,"token_lifetime":86400,"token_lifetime_for_web":7200,"signing_alg":"RS256","scopes":[{"value":"create:foo","description":"Can create Foo"},{"value":"read:foo","description":"Can read Foo"}]}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 89.073583ms + - 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/users/auth0%7C646cad06363aac78e30fc478 + 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-23T12:09:42.690Z","email":"testaccuserpermissionsimport@acceptance.test.com","email_verified":false,"identities":[{"connection":"Username-Password-Authentication","user_id":"646cad06363aac78e30fc478","provider":"auth0","isSocial":false}],"name":"testaccuserpermissionsimport@acceptance.test.com","nickname":"testaccuserpermissionsimport","picture":"https://s.gravatar.com/avatar/39316dfffecd747d8943eac17de89b23?s=480&r=pg&d=https%3A%2F%2Fcdn.auth0.com%2Favatars%2Fte.png","updated_at":"2023-05-23T12:09:42.690Z","user_id":"auth0|646cad06363aac78e30fc478"}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 105.704666ms + - 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%7C646cad06363aac78e30fc478/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":[],"start":0,"limit":50,"total":0}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 94.778084ms + - 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%7C646cad06363aac78e30fc478/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":[{"permission_name":"create:foo","description":"Can create Foo","resource_server_name":"Acceptance Test - testaccuserpermissionsimport","resource_server_identifier":"https://uat.api.terraform-provider-auth0.com/testaccuserpermissionsimport","sources":[{"source_id":"","source_name":"","source_type":"DIRECT"}]},{"permission_name":"read:foo","description":"Can read Foo","resource_server_name":"Acceptance Test - testaccuserpermissionsimport","resource_server_identifier":"https://uat.api.terraform-provider-auth0.com/testaccuserpermissionsimport","sources":[{"source_id":"","source_name":"","source_type":"DIRECT"}]}],"start":0,"limit":50,"total":2}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 90.322667ms + - 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%7C646cad06363aac78e30fc478/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":[{"permission_name":"create:foo","description":"Can create Foo","resource_server_name":"Acceptance Test - testaccuserpermissionsimport","resource_server_identifier":"https://uat.api.terraform-provider-auth0.com/testaccuserpermissionsimport","sources":[{"source_id":"","source_name":"","source_type":"DIRECT"}]},{"permission_name":"read:foo","description":"Can read Foo","resource_server_name":"Acceptance Test - testaccuserpermissionsimport","resource_server_identifier":"https://uat.api.terraform-provider-auth0.com/testaccuserpermissionsimport","sources":[{"source_id":"","source_name":"","source_type":"DIRECT"}]}],"start":0,"limit":50,"total":2}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 118.571416ms + - 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%7C646cad06363aac78e30fc478/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":[{"permission_name":"create:foo","description":"Can create Foo","resource_server_name":"Acceptance Test - testaccuserpermissionsimport","resource_server_identifier":"https://uat.api.terraform-provider-auth0.com/testaccuserpermissionsimport","sources":[{"source_id":"","source_name":"","source_type":"DIRECT"}]},{"permission_name":"read:foo","description":"Can read Foo","resource_server_name":"Acceptance Test - testaccuserpermissionsimport","resource_server_identifier":"https://uat.api.terraform-provider-auth0.com/testaccuserpermissionsimport","sources":[{"source_id":"","source_name":"","source_type":"DIRECT"}]}],"start":0,"limit":50,"total":2}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 94.71175ms + - id: 16 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 292 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: | + {"permissions":[{"resource_server_identifier":"https://uat.api.terraform-provider-auth0.com/testaccuserpermissionsimport","permission_name":"create:foo"},{"resource_server_identifier":"https://uat.api.terraform-provider-auth0.com/testaccuserpermissionsimport","permission_name":"read:foo"}]} + 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%7C646cad06363aac78e30fc478/permissions + 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: 112.855583ms + - id: 17 + 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%7C646cad06363aac78e30fc478 + 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: 162.230334ms + - id: 18 + 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/resource-servers/646cad063390a55e156ee4cd + 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: 342.607167ms