diff --git a/internal/cli/terraform_fetcher.go b/internal/cli/terraform_fetcher.go index f28a411af..f8a030bae 100644 --- a/internal/cli/terraform_fetcher.go +++ b/internal/cli/terraform_fetcher.go @@ -2,6 +2,7 @@ package cli import ( "context" + "strings" "github.com/auth0/go-auth0/management" "github.com/google/uuid" @@ -202,6 +203,10 @@ func (f *customDomainResourceFetcher) FetchData(ctx context.Context) (importData customDomains, err := f.api.CustomDomain.List(ctx) if err != nil { + if strings.Contains(err.Error(), "The account is not allowed to perform this operation, please contact our support team") { + return data, nil + } + return nil, err } diff --git a/internal/cli/terraform_fetcher_test.go b/internal/cli/terraform_fetcher_test.go index 4888033c0..3ecbdc1ce 100644 --- a/internal/cli/terraform_fetcher_test.go +++ b/internal/cli/terraform_fetcher_test.go @@ -524,6 +524,26 @@ func TestCustomDomainResourceFetcher_FetchData(t *testing.T) { _, err := fetcher.FetchData(context.Background()) assert.EqualError(t, err, "failed to list custom domains") }) + + t.Run("it returns empty set error if unsupported feature error occurs", func(t *testing.T) { + ctrl := gomock.NewController(t) + defer ctrl.Finish() + + customDomainAPI := mock.NewMockCustomDomainAPI(ctrl) + customDomainAPI.EXPECT(). + List(gomock.Any()). + Return(nil, fmt.Errorf("403 Forbidden: The account is not allowed to perform this operation, please contact our support team")) + + fetcher := customDomainResourceFetcher{ + api: &auth0.API{ + CustomDomain: customDomainAPI, + }, + } + + data, err := fetcher.FetchData(context.Background()) + assert.NoError(t, err) + assert.Len(t, data, 0) + }) } func TestGuardianResourceFetcher_FetchData(t *testing.T) {