diff --git a/internal/cli/terraform_fetcher.go b/internal/cli/terraform_fetcher.go index 209840d3..44bda3df 100644 --- a/internal/cli/terraform_fetcher.go +++ b/internal/cli/terraform_fetcher.go @@ -227,10 +227,16 @@ 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 + errNotEnabled := []string{ + "The account is not allowed to perform this operation, please contact our support team", + "There must be a verified credit card on file to perform this operation", } + for _, e := range errNotEnabled { + if strings.Contains(err.Error(), e) { + return data, nil + } + } return nil, err } diff --git a/internal/cli/terraform_fetcher_test.go b/internal/cli/terraform_fetcher_test.go index e24e5d08..054f3bae 100644 --- a/internal/cli/terraform_fetcher_test.go +++ b/internal/cli/terraform_fetcher_test.go @@ -561,6 +561,26 @@ func TestCustomDomainResourceFetcher_FetchData(t *testing.T) { assert.NoError(t, err) assert.Len(t, data, 0) }) + + t.Run("it returns empty set error if no verified CC 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: There must be a verified credit card on file to perform this operation")) + + fetcher := customDomainResourceFetcher{ + api: &auth0.API{ + CustomDomain: customDomainAPI, + }, + } + + data, err := fetcher.FetchData(context.Background()) + assert.NoError(t, err) + assert.Len(t, data, 0) + }) } func TestFormResourceFetcher_FetchData(t *testing.T) {